PIVOT Programmers Needed!
awsoukhaphon
Extra Credit
You may work in groups but everybody in the group MUST put down who they worked with! No
exceptions!
1. Implement a function called RPS() which is a game of Rock, Paper, Scissor. The game will consist of
you (the user) playing against the computer.
The computer will obtain its values from the built in Python randomizer (import random). The function
must contain the following for full credit:
1. Accept user input to determine what the user selects (Rock, Paper or Scissor)
2. Loop continuously until 'quit' is entered
3. If the user enters something other than ‘r’, ‘p’, or ‘s’ then they should be notified but the
game should continue.
4. Keep score for both the player and CPU
5. After each turn print out the results, what each player had selected and the current score
6. After 'quit' is entered print out a recap of the game including the final score and who won or
if there was a tie.
2. Implement a function called topRated(). The function will take a file name as a parameter and return
a sorted list. The file it reads in contains 500 numeric movie IDs and their rating by user. The function
should return a list of movie IDs and their average rating based on the file data. The list that is returned
should also be sorted by average rating. I have included code in the extra credit template to do that for
you.
HINT: The best way to tackle this problem is to break it up into two parts. You must first read
the file in and create a dictionary of all the movie IDs as keys. The value to those keys should be a list.
Worry about solving the average after the dictionary is created.
3. What good are movie IDs and ratings? You want to know the actual title of the movie! Implement a
function called getTitles(). The function takes two parameters. The first is the list we created in the
previous problem. The second is a text file containing movie IDs and titles. The function should loop
through the list of IDs that is passed to it and through the text file. When an ID in the list matches that
of an ID in the text file you know the title in the text file is associated with that ID. Return a sorted list
by average rating. I have included code in the extra credit template to do that for you.