I'm a beginner who just started Python. I don't think I understand.
age = input ("Please enter your age")
print ("Your age is %s".")
if age <= 19:
print ("You're Minors")
else :
print ("You're an adult")
If you're under 19 after you get your age, you're a minor Other than that, I want to write as an adult I keep getting errors. Could you tell me what you typed wrong?
python
age = input ("Enter your age")
where input stores the entered value in str, i.e. age as a string.
Therefore, int 19 and str 19 stored in age have different data types
The conditional expression does not hold.
So in front of the input, the data type is an integer type
You have to write int(), which is a function that you want to.
age = int("Enter your age")
print ("Your age is %s." %age)
if age <= 19:
print ("You're Minors")
else :
print ("You're an adult")
© 2024 OneMinuteCode. All rights reserved.