Question
01 Checkpoint: Review Python Purpose Write a Python program that gets input from a user, uses variables, performs arithmetic, and displays results for the user
01 Checkpoint: Review Python Purpose Write a Python program that gets input from a user, uses variables, performs arithmetic, and displays results for the user to see. Problem Statement When you physically exercise to strengthen your heart, you should maintain your heart rate within a range for at least 20 minutes. To find that range, subtract your age from 220. This difference is your maximum heart rate per minute. Your heart simply will not beat faster than this maximum (220 age). When exercising to strengthen your heart, you should keep your heart rate between 65% and 85% of your hearts maximum rate. Assignment Write a Python program named heart_rate.py that asks for a persons age and computes and outputs the slowest and fastest rates necessary to strengthen his heart. To start your program, copy and paste the following code into your program and use it as an outline as you write code. Note that in a Python program, a triple quoted string at the top of the file acts as a comment for the entire program. """ When you physically exercise to strengthen your heart, you should maintain your heart rate within a range for at least 20 minutes. To find that range, subtract your age from 220. This difference is your maximum heart rate per minute. Your heart simply will not beat faster than this maximum (220 - age). When exercising to strengthen your heart, you should keep your heart rate between 65% and 85% of your hearts maximum rate. """ Helpful Documentation The preparation content for this lesson explains how to write code to do the following: Get input from a user Convert user input from a string to a number Calculate results Display results for the user to see Testing Procedure Verify that your program works correctly by following each step in this testing procedure: Run your program and enter the input shown below. Ensure that your programs output matches the output below. > python heart_rate.py Please enter your age: 23 When you exercise to strengthen your heart, you should keep your heart rate between 128 and 167 beats per minute. Run your program using your age or the age of one of your parents. Use a calculator to ensure that the output is correct. Sample Solution When your program is finished, view the sample solution [] for this assignment to compare your solution to that one. Before looking at the sample solution, you should work to complete this checkpoint program. However, if you have worked on it for at least an hour and are still having problems, feel free to use the sample solution to help you finish your program. Ponder During this assignment, you wrote a Python program that gets input from a user, uses variables, performs arithmetic, and displays results for the user to see. Because you should have learned how to write this type of program in CSE 110, this assignment should have been fairly easy for you. If this assignment was difficult for you, you should review the concepts from CSE 110 and the programs that you wrote in that course.
Step 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