Assignment 9 - CS 116 Fall 2009 Assignment 9 Due at 3:30 PM...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 116 Fall 2009 Assignment 9 Due at 3:30 PM on Thursday, December 3 For all assignments, you are expected to use the design recipe when writing functions from scratch. The solutions you submit must be entirely your own work. Do not look up either full or partial solutions on the Internet or in printed sources. Please read the course Web page for more information on assignment policies and how to organize and submit your work. Be sure to download the interface file from the course Web page and to follow all the instruc- tions listed in the Python style guide (on the Web page). Specifically, your solutions should be placed in files a9qY . py , where Y is a value from 1 to 4. This homework largely tests your understanding of the material in the second half of CS 116 Lecture Module 8, and in all of Module 9. A note on online submission: if there is a problem at the deadline for the assignment, please check http://www.student.cs.uwaterloo.ca/ ˜ cs116 , which should be available even if Odyssey is not working. Further information may be available there. Language level: Any Python version in the range 2.5.0 to 2.6.2. On the student.cs machines, type /opt/csw/bin/python to access version 2.6.2 (just typing python brings up version 2.4.2, which you should not be using). 1. Recall a meeting_time structure has been introduced in Assignment 1. We now represent this structure by using a Python class: the class has three fields. The first field, month , is a string from the set that contains ”Jan” , ”Feb” , ”Mar” , ”Apr” , ”May” , ”Jun” , ”Jul” , ”Aug” , ”Sep” , ”Oct” , ”Nov” , ”Dec” . The second field, day , is a string representing numbers in the range [0: days ] , where days is the number of days in the corresponding month . The third field, hr , is an integer in the range [8:20] corresponding to the starting hour for a meeting (earliest time is 8am, latest time is 8pm which is specified as hour 20). The Python definition for a meeting_time class is: class meeting_time : ’ F i e l d s : month, day, h r ’ (a) Write a function afternoon that consumes a list of meeting_time s and produces a list of meeting_time s that occur in the afternoon ( 12 <= h <= 17 ). (b) Write a function create_meetings that consumes a dictionary representing an event, and a list of meeting_time s. In the dictionary, the name of the event is the key, and the date of the event is the value. The value of the dictionary should match the date in the list of meeting_time s. For example, an orientation event dictionary can be
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern