Hello guys, so I'm taking my first course in Programming and our teacher assigned us to create a BMI calculator in Python, but I would like to know how to implement validation in my user inputs, that my code rejects input that isn't "allowed/invalid" e.g ("Yes Or no") ("Enter your age") and thus the code exits out.
while True: try: height = float(input("Input your height in meters: ")) raise ValueError() print("Incorrect, Try again") else: break weight = float(input("Input your weight in kilogram: ")) userBmi = round(weight / (height * height), 2)right now, this section of code won't even run and yields a "SyntaxError". I would appreciate any help given and a exemplar of how you implemented it, thanks!