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
Python
program 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
price
of the movie's ticket, in dollars. - The
rating
which 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 interested
very interested
moderately interested
barely interested
completely uninterested
- The following are the criteria upon which you make your movie viewing decisions. Hint:
Implement these in
Python
using anif-elif-else
code structure.- You like bargains. Any movie that costs less than $5.00 is one that you are
extremely interested
in 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 uninterested
in seeing it. However, if that movie happened to recieve 5 stars, then you arebarely interested
in seeing it. - You enjoy high quality movies. You are
very interested
in seeing any movie that has a price below $12.00, and is rated greater than 4 stars. - You are
moderately interested
in 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 interested
in seeing, as long as it costs less than $5.00. - If any movie falls outside of the previously mentioned criteria, then you are
completely uninterested
in 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
Python
program in the filemoviecritic.py
that 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.py
to execute thePyUnit
test bench.PyUnit
indicates a successful test with anOK
output, and an unsuccessful test with aFAIL
output.
Submission
- Upload the file
moviecritic.py
to the Web-CAT automated grading platform.