$29.99
CPSC 231 Assignment 02
Statistics on Movie and it’s rating Database
In this assignment, you will perform different statistical operation on a movie database and extract
useful information. This movie database contains list of 30 movies and ratings for these movies.
There are two problems in this assignment. For the problem 1, a list of 30 movies and corresponding
ratings (or scores) are already provided in problem1.py file. The rating is based on the following scale:
0 Never seen it.
1 It was terrible!
2 Didn’t like it.
3 It was OK.
4 Liked it.
5 It was awesome!
For problem 2, same list of 30 movies is provided. In addition to movie list, rating from five friends about
every movie is also provided in problem2.py file. The problem2.py contains two lists:
A list of movies
Rating (or scored) of each movie from five friends
Problem 1: Personal Summary (1 + 2 + 2 = 5 marks)
For this problem, you should first download problem1.py from D2L. It contains a list of 30 movies and
corresponding ratings.
Write a program that does not take any input and prints the following to the screen:
1. The number of movies seen out of the total number of movies.
2. A list of favorite titles (with the highest possible rating).
3. A list of least favorite titles (with the lowest possible rating).
Sample Run:
Hello [YourName]!
It looks like you've seen 21 out of the 30 movies.
Your favorite movies were:
The Ring (2002)
Deadpool (2016)
Your least favorite movies were:
Wall-E (2008)
Million Dollar Baby (2004)
Ratatouille (2007)
Baywatch (2017)
The Matrix Revolutions (2003)
Problem 2: Friend’s rating statistics (1 + 3 + 2 + 3 + 2 = 11 marks)
For this problem, you should first download problem2.py from D2L. It contains a list of 30 movies and
rating from five friends about each movie as a single list.
Write a program that compute the following statistics:
1. Average number of movies seen: How many of our 30 movies, on average, has a friend seen?
Calculate the average number of non-zero ratings per individual in our data set.
2. Most popular movies: Which of our movies have been seen by the most? Find the movies that
have the most number of non-zero ratings from friends.
3. Least popular movies: Which movies have been seen by the least? Find the movies that have the
most number of zero ratings.
4. Highest rated movies. Which movies from the list are the “best” movies according to the
friends? Find the movies that have the highest average rating among friends. Do not include 0
ratings (never seen it) when calculating the average.
5. Lowest rated movies. Which are the worst movies? Find the movies that have the lowest
average rating. Again, do not include 0 ratings.
Sample Run:
On average, Each friend has seen 21.4 of the 30 movies.
The most popular movies were:
Wall-E (2008)
Minions (2015)
Ratatouille (2007)
Deadpool (2016)
The least popular movies were:
The Incredibles (2004)
The Strangers (2008)
Stalker (1979)
Up (2009)
Thor: Ragnarok (2017)
The highest rated movies were:
Wall-E (2008)
Deadpool (2016)
The lowest rated movies were:
Baywatch (2017)
The Matrix Revolutions (2003)
Submission:
After you have completed this assignment, you should have written a total of two Python programs,
saved as .py files.
Please ensure that your files are named descriptively, with the problem number included, so that your
TA can easily see which program is associated with each problem.
Use the University of Calgary Desire2Learn system (http://d2l.ucalgary.ca) to submit your assignment
work online. Log in using your UofC eID and password, then find our course, cpsc 231 l01 and l02, in the
list. Then navigate to Assessments -> Dropbox Folders, and find the folder for Assignment #2 here.
Collaboration
Discussing the assignment requirements with others is a reasonable thing to do, and an excellent way to
learn. However, the work you hand-in must ultimately be your work. This is essential for you to benefit
from the learning experience, and for the instructors and TAs to grade you fairly. Handing in work that is
not your original work, but is represented as such, is plagiarism and academic misconduct. Penalties for
academic misconduct are outlined in the university calendar.
Here are some tips to avoid plagiarism in your programming assignments.
1. Cite all sources of code that you hand-in that are not your original work. You can put the citation
into comments in your program. For example, if you find and use code found on a web site, include
a comment that says, for example:
# the following code is from
https://www.quackit.com/python/tutorial/python_hello_world.cfm.
Use the complete URL so that the marker can check the source.
2. Citing sources avoids accusations of plagiarism and penalties for academic misconduct. However,
you may still get a low grade if you submit code that is not primarily developed by yourself.
3. Discuss and share ideas with other programmers as much as you like, but make sure that when you
write your code that it is your own. A good rule of thumb is to wait 20 minutes after talking with
somebody before writing your code. If you find yourself exchanging code by electronic means,
writing code while sitting and discussing with a fellow student, typing what you see on another
person’s console, then you can be sure that “your” code is not substantially your own, and your
sources must then be cited to avoid plagiarism.
4. Collaborative coding is strictly prohibited. Your assignment submission must be strictly your code.
Discussing anything beyond assignment requirements and ideas is a strictly forbidden form of
collaboration. This includes sharing code, discussing code itself, or modeling code after another
student's algorithm. You cannot use (even with citation) another student’s code.
5. We will be looking for plagiarism in all code submissions, possibly using automated software
designed for the task. For example, see Measures of Software Similarity (MOSS -
https://theory.stanford.edu/~aiken/moss/).
Remember, if you are having trouble with an assignment, it is always better to go to your TA and/or
instructor to get help, than it is to plagiarize.
Credits:
A few problems were derived from problems originally posted by Prof. Sonny Chen from University of
Calgary.
Grading:
There are total 16 marks for this assignment. If you have completed all the problems, you would get 16
marks.