BMI Calculator python code

 

print("######## Welcome to BMI calculator ########")time.sleep(1)
name = input("Please give me your name: \n")hieght = float(input("Enter your hieght in meters: \n"))weight = float(input("How much is your weight in Kg: \n"))
BMI = round(weight/(hieght * hieght),2)

def wait():
    print("Let me calculate your BMI. Hold tight.")
    print("-------------------------------------------------------------------")
    print(". --> Calculating your BMI", name)
    time.sleep(2)
    print(".. --> Please wait", name)
    time.sleep(2)
    print(".. -->", name, "Just a second.")
    print("-------------------------------------------------------------------")
    time.sleep(2)

def mainfunc():
    if (BMI < 18):
        print(name, "You are seriously underweight. Your condition is critical as your BMI score is ", BMI)
    elif (BMI >= 18 and BMI <= 18.5):
        print(name, "Your weight is average. Try some healthy diet. Your BMI score is ", BMI)
    elif (BMI > 18.5 and BMI <= 24.99):
        print(name, "You have healthy weight as your BMI score is ",BMI)
    elif (BMI > 24.99 and BMI < 30.00):
        print(name, "You are slightly  higher than required weight as your BMI score is ", BMI)
    elif (BMI >= 30):
        print(name, "!!! OVERWEIGHT !!! You seriously need to reduce your weight. Your BMI score is ", BMI)
wait()
mainfunc()

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.