PA 10: lous _list.pyFor each line on the page, the fields are (in order):+ Dept ID (0)+ Course Number (1)+ Section (2)+ Course Title (3)+ Instructor (4) — which may end with +1 (or more; GBUS...

1 answer below »
Programming Assignment in python


PA 10: lous _list.py For each line on the page, the fields are (in order): + Dept ID (0) + Course Number (1) + Section (2) + Course Title (3) + Instructor (4) — which may end with +1 (or more; GBUS has a +4 lecture) for multi-instructor classes. This will always be a single-digit number if present. + Type of class (5) + Hours (6) + Monday (7) + Tuesday (8) + Wednesday (9) + Thursday (10) + Friday (11) + Start Time (12) + End Time (13) + Location (14) + Enrollment (15) + Allowable Enrollment (16) Start and end times are expressed as a 3- or 4-character string representing a 24-hour clock so, CS 1112 starts at 1400 and ends at 1515, for a duration of 75 minutes; CS 2150 section 101 starts at 930 and ends at 1015 for a duration of 10S minutes. Sections without times are not listed. 2.2 Your Functions 22.1 instructor_lectures (department, instructor) Returns a list of all the course names for the lectures (not laboratories, discussions, etc.) taught by a given instructor (within the given department). If an instructor teaches multiple lecture sections of the same class, you should only add the class name once (i.c., there should be no duplicates of any class names in the list that you return. The list should include all classes that list the given instructor, even if it has a +1 (or something similar) listed as well. For example, calling this function for the cs department with Luther Tychonievich as the instructor should return [* Introduction to Programming']. PA 10: lous _list.py 1 Task Goal It can be tough to search through the course listings to find the classes you want. So let's write a program to help you out! Instead of reading from a live website that may be changing frequently, we are going to use data from a snapshot of a previous semester. 2 Tas ‘Write a library called 10us_1ist.py that will contain two functions that will aid students and instructors in finding information about classes. 2.1 The Data ‘We could have you write programs that access directly, but we don’t want Lou Bloomfield to get upset if you all start having programs reading his site repeatedly. Instead, we'll use snapshots hosted within our own course’s webspace. For example, if you want to see all the courses in the CS department, can go to: and you'll see many lines like this: CS111101002| Introduction to Programming|Upsorn Praphamontripong| Lecture |3| true|false|true|false|true|1100]1150 Wilson Hall 301]181]200 We use the vertical-bar | as a separator because all of the more common separators (.» 3, etc) are used at UVa as part of course titles. By replacing the text after the last / with any department at UVa, you can see their classes; for example, 10x will load all Biology classes. PA 10: lous _list.py 3 Example Invocations When you run lous List. py, nothing should happen. It defines functions, it does not run them. If in another file (which you do not submit) you write the following: import lous_list print (lous_list. instructor_lectures('STs’, "Kathryn Neeley')) print (lous_list. instructor_lectures('STs’, ‘Raymond Pettit')) print('-" * 56) print (lous_list.compatible_classes('Cs 1110-661", 601')) print (lous_list. compatible classes('Cs 1110-661", 601’, True)) print (lous_list.compatible_classes('Cs 1110-661", 601')) You should get the following output: [science and Technology in Social and Global Context’, ‘The Engineer, Ethics, and Professional Responsibility'] False True False 4 Troubleshooting Each department has its own URL: hitp://arcanum.cs.virginia.edw/es1110/files/louslist/CS, , etc. ‘That ending string (cs, £Cz, etc) is provided in the arguments to cach function. Don’t forget to decode (*ut£-8') what you read from the web. Stray \n in your strings? You probably forgot to strip () before you split (...). Confused about how to use the information provided in the compatible classes arguments? Try the split (. ..) method, it is your friend. Because the +1 indicator is always a single-digit number if present, it can be detected by looking for the + (which always has the same index from the end of the string). Copyright © 2022 and Raymond Petit. PA 10: lous _list.py 22.2 compatible_classes (first_class, second class, needs_open_space=False) Returns True if the two given classes are compatible within the same schedule and alse otherwise. Additionally, when the needs _open_space argument is True, the function should return False if cither of the classes has reached enrollment capacity (regardless of whether or not the classes are compatible). Two classes are considered compatible if there is no overlap between their schedules. For example: + Cs 2150-001 is 2:00-2:50 on MonWedFri and cs 2150-002 is 1:00-1:50 on MonWedFri. These two classes are compatible since they occur at different times. Cs 2150-001 is 2:00-2:50 on MonWedFri and cs 3240-001 is 2:00-3:15 on TueThurs. These two classes are compatible since they never occur on the same day. Cs 2150-001 is 2:00-2:50 on MonWedFri and cs 4102-001 is 2:00-3:15 on MonWed. These two classes are not compatible since they are both in session between 2:00-2:50 on MonWed. Note that if one class starts at the exact same time another one ends that is considered overlap (i.c., those classes would not be compatible). Some notes about the parameters: + The class numbers will include section numbers. For example, cs 1110-001. + The classes could be in different departments. + You can assume that every class identifier passed as an argument will exist on the website. The classes could be the same class. If this is the case, you should consider them not compatible since they occur at the same time. 2.3 Style Matters In addition to functional correctness, some points may be reserved for 1. having good variable names 2. having code that s casy to follow
Answered Same DayNov 08, 2022

Answer To: PA 10: lous _list.pyFor each line on the page, the fields are (in order):+ Dept ID (0)+ Course...

Nidhi answered on Nov 09 2022
41 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here