Lab 3: Movie Critic
Web-CAT: Submit Python programs to this automated grading platform.
Task Outline
- Due Date: Friday, September 20, 2019
- Total Points: 10
- In this lab, you must write a
Pythonprogram that determines the user's interest in seeing a particular movie.
Background Theory
- You interest in a movie depends upon the following two factors:
- The
priceof the movie's ticket, in dollars. - The
ratingwhich the movie received, which can be any decimal number from 0 to 5, inclusive.
- The
- Your level of interest in a movie is shown by the following indicators:
extremely interestedvery interestedmoderately interestedbarely interestedcompletely uninterested
- The following are the criteria upon which you make your movie viewing decisions. Hint:
Implement these in
Pythonusing anif-elif-elsecode structure.- You like bargains. Any movie that costs less than $5.00 is one that you are
extremely interestedin viewing, as long as that movie has received 2 or more stars. - You dislike expensive movies. If a movie costs $12.00 or more, then you are
completely uninterestedin seeing it. However, if that movie happened to recieve 5 stars, then you arebarely interestedin seeing it. - You enjoy high quality movies. You are
very interestedin seeing any movie that has a price below $12.00, and is rated greater than 4 stars. - You are
moderately interestedin seeing any movie which costs between $5.00 and $11.99, as long as those movies received between 2 and 4 stars, inclusive. - You dislike poorly rated movies. Any movie that has received less than 2 stars is one that you are
barely interestedin seeing, as long as it costs less than $5.00. - If any movie falls outside of the previously mentioned criteria, then you are
completely uninterestedin seeing it.
- You like bargains. Any movie that costs less than $5.00 is one that you are
- Note that the function
selectfilm()returns the variableoutcome. You must assign the corresponding interest string to the variableoutcome, before it is returned.
Code Distribution
| Description | File Size | File Name |
|---|---|---|
Python Source Code for Movie Critic |
1.3KB | lab03.zip |
Contents of lab03.zip:
Lab03MovieCritic/
├── moviecritic.py
└── testmoviecritic.py
Specification
- Write a
Pythonprogram in the filemoviecritic.pythat produces an output which corresponds to your particular interest in a certain movie. - You will write your solution in a function called
selectfilm(price, rating)right below the place where it says:YOUR CODE HERE - When the function call
selectfilm(6.5, 3,5)is executed, the output of the program should be:moderately interested
Testing
- Run the file
testmoviecritic.pyto execute thePyUnittest bench.PyUnitindicates a successful test with anOKoutput, and an unsuccessful test with aFAILoutput.
Submission
- Upload the file
moviecritic.pyto the Web-CAT automated grading platform.