Graded Problem Set #2.2
Conditionals
Background
These problems should be completed on your own. Unlike the practice problems, where you are allowed, and even encouraged, to talk about the process with your classmates, these should be attempted on your own. If you have difficulty with these, please reach out to me for assistance or guidance.
These problems will be completed using an editor such as Thonny or IDLE and submitted to Autolab for grading.
Activities
Please try to make your program output look as much like the example as possible and verify it works with the example input provided. If you have difficulty finding the information or understanding how to approach the problem, you should contact me.
To complete this activity, you will need to create the following scripts:
- Cond G1 - Crazy Al's Bargain Barn
- Cond G2 - How Cloudy is it?
- Cond G3 - Can I retire?
- Cond G4 - QB Passer Rating Category
Cond G1
Bargain. Bargain. Who wants a bargain?
Crazy Als Bargain Barn sells bangles and baubles for cheap. Everything is normally 99 cents each . However, if you buy more than 25 things he sells them to you for 94 cents each.
Write a Python script that conforms to the following
- Inputs
- asks for the number of items you are purchasing
- Print Statements
-
The cost of the items (rounded to 2 decimal places
- Example(s)
Cond G2
How Cloudy is it?
Stormy Whether is the meteoroligist at the local TV station. [Sure, you laugh at that made up name, but do you think the local CBS guy's REAL name is Joe WINTERS?]
Write a Python script that conforms to the following
- Inputs
- asks for the percentage of clouds
- Print Statements
-
The category based on the following table:
-
Percentage Description Exactly 0% Clear Up to but not including 25% Few Clouds Up to but not including 50% Scattered Clouds Up to but not including 75% Broken Clouds 75% or higher Overcast
-
- Example(s)
- NOTE:
- Remember that Python is case sensitive and Autolab will be looking for the Descriptions assigned above. This may seem like a hassle. But it is important.
Cond G3
Can I retire yet?
Ike Witt is tired of teaching. He wants to know if he can afford to retire. To draw IPERS (Iowa Public Employees Retirement System) retirement one must meet at least one of three conditions:
- age is 65 or more.
- age is at least 62 and years of service is at least 20
- sum of age and years of service equals or exceeds 88
Write a Python script that conforms to the following
- Inputs
- asks for your age
- asks for number of years you have been working for IPERS
- Print Statements
- Yes or No
- Example(s)
Cond G4
Quarterback Passer Rating Category
Steve Lers is a statistician working for the NFL. Part of his job is to keep track of how the Quarterbacks are doing each season. Over the years the NFL has used a statistic called the Quarterback Passer Rating (https://en.wikipedia.org/wiki/Passer_rating) to compare how QBs are doing compared to each other and compared to themselves year over year. The formula (we will look at the actual formula later in the course) produces a score between 0 and 158.3333333. The higher the rating the better season the QB is having. Furthermore, there is some consensus that we can "categorize" the year a player is having using the following analysis.
| Rating | Category |
|---|---|
| 0 to 85 | Bad |
| Above 85 but 90 or lower | Mediocre |
| Above 90 but 95 or lower | Good |
| Above 95 and up to 158.33333 | Great |
Write a Python script that conforms to the following
- Inputs
- asks for the player's current rating
- Print Statements
- if the score entered is "valid" [0-158.33333] then it prints the category from the table above
- or
- if the score is invalid then it prints "ERROR"
- Example(s)



