def convert(s): f = float(s) c = (f - 32) * 5/9 return c print(convert(78)
Height=float(input("Enter your height in centimeters: ")) Weight=float(input("Enter your Weight in Kg: ")) Height = Height/100 BMI=Weight/(Height*Height) print("your Body Mass Index is: ",BMI) if(BMI>0): if(BMI<=16): print("you are severely underweight") elif(BMI<=18.5): print("you are underweight") elif(BMI<=25): print("you are Healthy") elif(BMI<=30): print("you are overweight") else: print("you are severely overweight") else:("enter valid details")
def check_guess(guess, answer):
global score
still_guessing = True
attempt = 0
while still_guessing and attempt < 3:
if guess.lower() == answer.lower():
print("Correct Answer")
score = score + 1
still_guessing = False
else:
if attempt < 2:
guess = input("Sorry Wrong Answer, try again")
attempt = attempt + 1
if attempt == 3:
print("The Correct answer is ",answer )
score = 0
print("Guess the Animal")
guess1 = input("Which bear lives at the North Pole? ")
check_guess(guess1, "polar bear")
guess2 = input("Which is the fastest land animal? ")
check_guess(guess2, "Cheetah")
guess3 = input("Which is the larget animal? ")
check_guess(guess3, "Blue Whale")
print("Your Score is "+ str(score))
No comments:
Post a Comment