Programming exercise | Computer Science homework help
Please write a Python Code to solve these problems and include the output of screen shot along with separate .py/ipy file in a single zip folder
2.9 (INTEGER VALUE OF A CHARACTER) Here’s a peek ahead. In this chapter, you learned about strings. Each of a string’s characters has an integer representation. The set of characters a computer uses together with the characters’ integer representations is called that computer’s character set. You can indicate a character value in a program by enclosing that character in quotes, as in ‘A’. To determine a character’s integer value, call the built-in function ord:
In [1]: ord(‘A’)
Out[1]: 65
Display the integer equivalents of B C D b c d 0 1 2 $ * + and the space character.
2.14 (TARGET HEART-RATE CALCULATOR) While exercising, you can use a heart-rate monitor to see that your heart rate stays within a safe range suggested by your doctors and trainers. According to the American Heart Association (AHA) ( HYPERLINK “http://bit.ly/AHATargetHeartRates” http://bit.ly/AHATargetHeartRates), the formula for calculating your maximum heart rate in beats per minute is 220 minus your age in years. Your target heart rate is 50–85% of your maximum heart rate. Write a script that prompts for and inputs the user’s age and calculates and displays the user’s maximum heart rate and the range of the user’s target heart rate. [These formulas are estimates provided by the AHA; maximum and target heart rates may vary based on the health, fitness and gender of the individual. Always consult a physician or qualified healthcare professional before beginning or modifying an exercise program.]