Jun-10-2017, 04:01 PM
I'm new to python and i'm trying to code for the first. I'm trying to follow the Else statement following this youtube video:
https : //www .youtube.com /watch?v=BS7ZcQ1BcE0&index=9&list=PLw02n0FEB3E2RDlD2cBULQjvXJ1K_jS1O
However, I ran into some error. Here is my code:
Are you male?(y/n)y
Traceback (most recent call last):
File "else.py", line 20, in <module>
isMale = bool (input("Are you male?(y/n)"))
File "<string>", line 1, in <module>
NameError: name 'y' is not defined
Any idea what went wrong?
https : //www .youtube.com /watch?v=BS7ZcQ1BcE0&index=9&list=PLw02n0FEB3E2RDlD2cBULQjvXJ1K_jS1O
However, I ran into some error. Here is my code:
weight = int(input("Enter weight in KG: \n")) height = int(input("Enter height in cm: \n")) age = int(input("Enter age: \n")) isMale = bool(input("Are you male?(y/n)")) if isMale: bmr = 66.5 + (13.75 * weight) + (5 * height) - (6.755 * age) else: bmr = 66.5 + (13.75 * weight) + (5 * height) - (6.755 * age) bmr= round(bmr) print(bmr)The error happens after inserting y. Here's the error message:
Are you male?(y/n)y
Traceback (most recent call last):
File "else.py", line 20, in <module>
isMale = bool (input("Are you male?(y/n)"))
File "<string>", line 1, in <module>
NameError: name 'y' is not defined
Any idea what went wrong?