Hello this is the following exercise.
Write a program that reads the age of the user and displays “Junior” for those under 18 years old, “Adult” from 18 years old, and “Senior” from 65 years old.
I was able to write down the code for Junior and Adult:
I do not know however, how to write the list for 65 years older.
One doubts whether the
range() function will be of any value for this problem. We are given an age then asked to identify the age group.
if age < 18
if age < 65
I came up with this so far:
x=int(input("give x: "))
if x<18==0 :
print(“x is Junior”)
if x<65==0 :
print(“x is Adult”)
print(“x is Senior”)
however, when I try x=7 I get “x is Senior”, which is not the case.
The relational expression,
x < 18 is a boolean, but a boolean is also an integer. The above,
x < 18 would only equal zero when it is False. No need to ‘fix’ it, all that needs done is remove