Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2.1 (What does this code do?) Create the variables x=2 and y=3, then determine what each of the following statements displays: ( 3 points) print

image text in transcribed

2.1 (What does this code do?) Create the variables x=2 and y=3, then determine what each of the following statements displays: ( 3 points) print (x=,x) print' VValue of', x+,x, 'is', (x+x)) print(' x==) print((x+y),x=,(y+x)) 2.6 (Odd or Even) Use if statements to determine whether an integer is odd or even. Hint: Use the remainder operator. An even number is a multiple of 2 . Any multiple of 2 leaves a remainder of 0 when divided by 2 . (4 points) 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) (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 5085% 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. (4 points) 2.15 (Sort in Ascending Order) Write a script that inputs three different floating-point numbers from the user. Display the numbers in increasing order. Recall that an if statement's suite can contain more than one statement. Prove that your script works by running it on all six possible orderings of the numbers. Does your script work with duplicate numbers? Hint: This is challenging. In later chapters you'11 do this more conveniently and with many more numbers. (4 points)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions

Question

What is the amount owed to C-Tech Manufacturing Inc.?

Answered: 1 week ago