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...

  • 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()...

  • 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...

  • 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...

  • 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,...

  • 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...

  • Please solve the following, please type out the code, and do not hand write because its...

    Please solve the following, please type out the code, and do not hand write because its hard to read. I would greatly appreciate it. (JAVA) Problem 1 In a class called H1P1, write a method called bmiOne that takes as arguments a mass in kilograms (a double) and a height in meters (also a double), and returns the body mass index (or BMI) for the given data. If we have mass -m kg and height-h meters, then BMI = Write...

  • Body Mass Index Calculator

    Create a BMI calculator applications that reads the user's weight in kilograms and height in meters, then calculates and displays the user's body mass index.Also, the application should display the following information from the Department of Health and Human Services, so the user can evaluate his/her BMI:BMI ValuesUnderweight: less that 18.5Normal: between 18.5 and 24.9Overweight: between 25 and 29.9Obese: 30 or greaterFormula for calculating BMI areBMI = weightInKilogramsheightInMeters x heightInMetersThe program is to be written in C++ langauge.I need some...

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
ADVERTISEMENT