Feb-08-2019, 12:14 PM
(Feb-08-2019, 12:02 PM)FranSPG Wrote: I see an indentation error there. You have to be careful with the indentations.Hello, your solution worked, thanks!
Try this solution
while True: try: height = float(input("Input your height in meters: ")) weight = float(input("Input your weight in kilogram: ")) userBmi = round(weight / (height * height), 2) print("User BMI: {}".format(userBmi)) break except ValueError: print("Incorrect, Try again")
However, (sorry) I have stumbled across another issue. I tried to replicate what you did with my other input questions but when I tested it with invalid input it simply continued, here is the section of the code that I have issues with.
userPreg=input(" Have you recently been involved in sexual activity and thus are now pregnant? Yes or No") if userPreg == "No": pass elif userPreg == "Yes": print("You're too active you testorene filled homo sapien") raise SystemExitHow would I implement something similar in this scenario? Sorry for bothering you