This is the code:
age = input("How Old Are You?")
gender = str(input("What is your gender (Please no caps)"))
if isinstance(age,int):
age = int(age)
else:
print("Enter a valid age")
age = int(age)
if gender == "male":
if age < 30:
print("Watch Captain America")
elif age > 30:
print("Watch Johnny English")
else:
print("Watch Iron Man")
elif gender == "female":
if age < 30:
print("Watch Frozen")
elif age > 30:
print("Watch Cinderella")
else:
print("Watch Fox and the Hound")
else:
print("Enter a Valid Gender")
This program recommends a movie for you to watch, based on age and gender.
I am not sure what the error is. This is written in Python 3.5.1 and does not work on Python 2.x.
Edit
Sorry, I did not explain it well enough, what I am trying to do is that if the User enters a character, then there is no error message, but they are prompted to try again.
That is the use of this block, which I cannot work out:
if isinstance(age,int):
age = int(age)
else:
print("Enter a valid age")