Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please respond in Python, thanks! Q5. (25 points) In football, there is a statistic for quarterbacks called the passer rating. To calculate the passer rating,
Please respond in Python, thanks!
Q5. (25 points) In football, there is a statistic for quarterbacks called the passer rating. To calculate the passer rating, you need five inputs: pass completions, pass attempts, total passing yards, touchdowns, and interceptions. Once the pass rating is computed from these inputs, one can use it to determine whether a quarterback had a mediocre, good, or great year. Write a short program that: (A) asks the user for the five inputs and then prints the pass rating (B) determines and displays whether the quarterback had a mediocre, good, or great year. To compute the pass rating, note the following algorithm: a) C is the "completions per attempt" times 100 minus 30 , all divided by 20. b) Y is the "yards per attempt" minus 3, all divided by 4. c) T is the "touchdowns per attempt" times 20. d) I is 2.375 minus ( "interceptions per attempts" times 35). e) The pass rating is the sum of C,Y,T, and I, all divided by 6 and then multiplied by 100 . A pass rating is poor if it is 85 or below, mediocre if above 85 , good if above 90 , and great if above 95 . In your program display "poor," "mediocre," "good," or "great" based on the pass rating. To test your program, use the following information taken from www.nfl.com from 2019: Sample Output: Enter the number of pass completions: 319 Enter the number of pass attempts: 484 Enter the total passing yards: 4031 Enter the number of touchdowns: 26 Enter the number of interceptions: 5 The pass rating is 103.59 Great rating. Enter the number of pass completions: 373 Enter the number of pass attempts: 613 Enter the total passing yards: 4057 Enter the number of touchdowns: 24 Enter the number of interceptions: 8 The pass rating is 85.80 Mediocre rating. Q6. (25 points) Write a short program to convert knuts to sickles and galleons (the currency of the Harry Potter novels). Note that there are 29 knuts in one sickle and 17 sickles in one galleon. The program should perform the calculation and print only non-zero values. In other words, if there not enough knuts for there to be a sickle, then " 0 sickle" should not be printed. If the user provides a negative knuts to be converted, the program should print "You cannot have a negative number of knuts." Also, if the user provides zero knuts to be converted, the program should print "You have zero knuts. Try again with non-zero knuts." Sample Output: How many knuts do you have?: 10 You cannot have a negative number of knuts. How many knuts do you have?: 0 You have zero knuts. Try again with non-zero knuts. How many knuts do you have?: 25 You have 25 knuts. How many knuts do you have?: 35 You have 1 sickles. You have 6 knuts. How many knuts do you have?: 500 You have 1 galleons. You have 7 knuts. How many knuts do you have?: 1100 You have 2 galleons. You have 3 sickles. You have 27 knuts. Q7. (10 points) Create a program that prompts for a positive number greater than 2 (check this condition), then keeps taking the square root of this number until the square root is less than 2. Print the value each time the square root is taken, along with the number of times the operation has been completed. Print the square root values to only 3 decimal places. Sample Output: Enter an integer greater than 2: 10000 1:100.000 2:10.000 3:3.162 4:1.778 DeliverableStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started