Question
Question 1.Body Mass Index (BMI) is a number calculated from a person's weight and height. The formula for BMI is: weight / height 2 where
Question
1.Body Mass Index (BMI) is a number calculated from a person's weight and height.
The formula for BMI is: weight / height2
where weight is in kilograms and height is in meters.
Write a program that:
- prompts user for weight and height in one input
- You decide whether to ask for Metric or Imperial (converting from pounds & inches back to metric)
- Remember to tell the user which measurement system you are expecting
You challenge yourself, try prompting the user for whether they want to enter Metric or Imperial.This is NOT required, and point will not be deducted for mistakes in this section of the code.
- performs BMI calculation
- prints BMI calculation
- Remember to tell the user that BMI is being printed
2. Using a 'for loop' , write a program that calculated and prints all the leap years from 1900 to 2020 (inclusive). Make sure that you understand the rules for determining a leap year and use the modulo operator to manually calculate leap years. Do not use the calendar library.
Then perform this calculation a second time using a 'while loop'.
3. Rewrite this following 'for loop' as a 'while loop' and create a working program:
Hint: X is a constant variable.
for i in range(1, X + 1):
if X % i == 0:
print(i)
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