Assignment 8

Assignment 8 - Assignment 8 Due Wednesday November 25 at...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Assignment 8 Due: Wednesday, November 25 at 3:30 pm For this and all subsequent assignments, you are expected to use the design recipe for Python 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. Do not copy your purpose statement directly from the problem statement – use your own words. 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 ±le from the course Web page and to follow all the instructions listed in the style guide (on the Web page). Speci±cally, your solutions should be placed in ±les, where Y is a value from 1 to 5. This assignment mostly tests your understanding of the material in CS 116 Lecture Module 8, iteration and dictionaries. You should write code using material from these sections of the notes only. Do not use recursion in your solutions. Read each question carefully to determine if there are further restrictions on how you can solve the problem. A note on online submission: if there is a problem at the deadline for the assignment, please check, 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.4. 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). Question 1: [Re-visiting Question 5 on Assignment 6] Write a Python function window , which consumes a single parameter, n , which determines how big the window will be, and produces None. The window that is drawn will have 4 equal panes, with “*” at the corners and centre, n “-”s at the top and bottom, and n “|”s at the sides, as in the examples below. In your solution, do not use string/integer multiplication (i.e. build any strings you need using the string addition operator and iteration, as needed). n=1 n=3 n=5 *-*-* | | | *-*-* | | | *-*-* *---*---* | | | | | | | | | *---*---* | | | | | | | | | *---*---* *-----*-----* | | | | | | | | | | | | | | | *-----*-----* | | | | | | | | | | | | | | | *-----*-----*
Background image of page 1

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

View Full Document Right Arrow Icon
Question 2: This question will revisit the movie rating system used in Assignment 4. Now, instead of defining a Scheme structure to store movie information, we will use a Python list as described below. A movie is a 3-element list m, where m[0] is a string for the movie title m[1] is a string for the movie genre (for example, “drama”, “comedy”, etc.) m[2] is a float between 0.0 and 10.0 for the movie's rating Suppose you have determined that your collection of movie ratings do have a bias towards dramas. As a result, you have decided to increase the ratings of all non-dramas by 10%. Write a function
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 6

Assignment 8 - Assignment 8 Due Wednesday November 25 at...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online