Question

Check the given program for errors and write the correct program : height = float(input("Enter height...

Check the given program for errors and write the correct program :
height = float(input("Enter height in meters: "))
weight = float(input("Enter weight in kg: "));
bmi == weight/(height**2)
print("Your BMI is:”,bmi”)
if ( bmi< 16)
print("severely underweight")
elif ( bmi>= 16 and bmi< 18.5):
print("underweight")
elif ( bmi>= 18.5 and bmi< 25):
print("Healthy")
elif ( bmi>= 25 and bmi< 30):
print("overweight")
elif ( bmi>=30):
print("severely overweight")
elseif:
print(“Not in Range)

Rewrite the entire program correctly and calculate the bmi for 5 users using ‘for’ loop.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code:

height = float(input("Enter height in meters: "))
weight = float(input("Enter weight in kg: "));
bmi = weight/(height**2)

print("Your BMI is:",bmi)

if ( bmi< 16):
print("severely underweight")
elif ( bmi>= 16 and bmi< 18.5):
print("underweight")
elif ( bmi>= 18.5 and bmi< 25):
print("Healthy")
elif ( bmi>= 25 and bmi< 30):
print("overweight")
elif ( bmi>=30):
print("severely overweight")
else:
print("Not in Range")
  
  
'''
no_of_users = 5
user_data = {}
for user in range(no_of_users):
user_name = input('Enter the user name: ')
height = float(input("Enter height in meters: "))
weight = float(input("Enter weight in kg: "));
bmi = weight/(height**2)
user_data[user_name] = bmi
  
print("%s's BMI is: %.4f"%(user_name, bmi))
  
if ( bmi< 16):
print("severely underweight")
elif ( bmi>= 16 and bmi< 18.5):
print("underweight")
elif ( bmi>= 18.5 and bmi< 25):
print("Healthy")
elif ( bmi>= 25 and bmi< 30):
print("overweight")
elif ( bmi>=30):
print("severely overweight")
else:
print("Not in Range")
'''

Screenshots:

Helght = float(input(Enter height in meters: weight = float(input(Enter weight in kg: ); bmi = weight/(height**2) Name -o HomeworkLib_bmi.py x height = float(input(Enter height in meters: ); weight = float(input(Enter weight in kg: )); bmi = weigh

Feel free to ask if you have any queries, Thanks.

Add a comment
Know the answer?
Add Answer to:
Check the given program for errors and write the correct program : height = float(input("Enter height...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a Java program that performs these operations Prompt the user to enter a low height...

    Write a Java program that performs these operations Prompt the user to enter a low height in feet (an integer) Prompt the user to enter a high height in feet (an integer) Prompt the user to enter a low weight in pounds (an integer) Prompt the user to enter a high weight in pounds (an integer) Print a table of Body Mass Index (BMI) for the heights and weights entered, ranging from the low height to the high height (inclusive),...

  • /////////////////////////////////////////////////////////////////////////////////// //This program // 1. asks the user her/his weight and height // 2. then calculates...

    /////////////////////////////////////////////////////////////////////////////////// //This program // 1. asks the user her/his weight and height // 2. then calculates the user's body-mass-index (BMI) // 3. and then prints an appropriate message based on the user's BMI /////////////////////////////////////////////////////////////////////////////////// #include <iostream> using namespace std; void printWelcome(); // ask the weight (in pounds) and height (in inches) of the user and store the values in formal // parameters weight and height, respectively void getWeightAndHeight(float& weight, float& height); // calculate and return the BMI (Body-Mass-Index) based on...

  • Write a program to calculate the Body Mass Index (BMI). The formulae to calculate the BMI...

    Write a program to calculate the Body Mass Index (BMI). The formulae to calculate the BMI are BMI = (weightinPounds x 703) / (heightinInches x heightinInches ) or BMI = weightinKilograms / (heightinMeters x heightinMeters ) Your program should read the user's weight in pounds and height in inches (or, Kilograms and meters, if you prefer), calculate and display the BMI. Your program should also display a message indicating how the BMI is evaluated, based on the following BMI values:...

  • BMI Class. Using JAVA write Object Oriented Programming by creating class, object and method , that...

    BMI Class. Using JAVA write Object Oriented Programming by creating class, object and method , that takes users' input (weight and Height) and calculates the BMI. If the result is less than 18.5 display "you are underweight", if the result is greater than 18.5 display "you have a normal weight", if the result is greater than 24.9 display "your weight is considered overweight", and the result is greater than 30 display "your weight is considered as obese" (BMI = 703...

  • I have this C program that calculates an input and converts it to a BMI calculation....

    I have this C program that calculates an input and converts it to a BMI calculation. Any idea how this would look as an LC3 program? I'm taking an LC3 programming class next semester and want an idea of what this code would even translate to, just trying to get a head start. I'm more so curious on how to get user input in a LC3 program, then I can try myself and figure it out from there. int main()...

  • Write a C program that reads the height and weight of a person and calculates the...

    Write a C program that reads the height and weight of a person and calculates the body mass index (bmi) according to formula bmi = weight/(height)2. Your program should display a qualitative assessment of the weight according to the following table: BMI value Letter Grade [0-20) Below normal weight [20-25) Normal weight [25-30) Overweight >=30 Obese Sample Output: Enter your weight in kilos: 70 Enter your height in meters: 1.80 Result: Normal weight Test values: (70 1.8) (50, 1.9) (90,...

  • IT Java code In Lab 8, we are going to re-write Lab 3 and add code...

    IT Java code In Lab 8, we are going to re-write Lab 3 and add code to validate user input. The Body Mass Index (BMI) is a calculation used to categorize whether a person’s weight is at a healthy level for a given height. The formula is as follows:                 bmi = kilograms / (meters2)                 where kilograms = person’s weight in kilograms, meters = person’s height in meters BMI is then categorized as follows: Classification BMI Range Underweight Less...

  • You are working as a software developer for a large insurance company. Your company is planning...

    You are working as a software developer for a large insurance company. Your company is planning to migrate the existing systems from Visual Basic to Java and this will require new calculations. You will be creating a program that calculates the insurance payment category based on the BMI score. Your Java program should perform the following things: Take the input from the user about the patient name, weight, birthdate, and height. Calculate Body Mass Index. Display person name and BMI...

  • read instructions carefully please matlab only Write a MATLAB function for a BMI calculator that receives the inputs for body weight (lbs)and height (ft) from the user's program, calculates th...

    read instructions carefully please matlab only Write a MATLAB function for a BMI calculator that receives the inputs for body weight (lbs)and height (ft) from the user's program, calculates the BMI using the equation below, displays the BMI category, and outputs the BMI value tothe user's program W (kg) h2 (m2) BMI Display Normal if 18.5 s BMI 25 Display Overweight if 25 s BMI <30 Display Obese if BMI 2 30 Else display underweight So you will create two...

  • Using python, write a program that lets the user enter this information: First name & Last...

    Using python, write a program that lets the user enter this information: First name & Last name weight age gender height systolic & diastolic blood pressure body temperature in Fahrenheit After the information has been entered, the results should be printed on the display based on the information below -BMI -Temp Conversion -Mean blood pressure -weight conversion (lbs to kg) -height conversion (inches to cm) The output should look like: First Name Last name is ___ cm and ____kgs. First...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT