lundi 28 septembre 2020

How would I fix this 'if' statement error?

I'm trying to make a BMI calculator for health class. I don't have any of the calculations yet, as I'm just testing the menu in the beginning. for some reason, every time I try to run the code, it shows me an error (shown below the code I have so far). I'm new to python, so this seems like a rookie mistake. if you could please help, that would be great.

*my code below

    ans = input('''
***The Body Mass Index***
    1. I use Kilograms and Metres
    2. I'M AMERICAN!!!
    ''')
if ans==1
    m = input("Your height in Metres")
    kg = input("Your weight in Kilograms")
if ans==2
    print("Stawp yelling at me!!")
    inc = input("Your height in Inches")
    lbs = input("Your weight in Pounds")
else
    print("please try again with a valid input")

the error appears after the first if statement:

 if ans==1

Aucun commentaire:

Enregistrer un commentaire