Write an if-else statement that compares the age variable with the value 65. If age is greater than or equal to 65, add 1 to senior_citizens. Otherwise, add 1 to non_seniors.
senior_citizens = 0
non_seniors = 0
while True:
age = input('enter age, or "stop"')
if age == 'stop':
break
else:
age = int(age)
if age > 65:
senior_citizens+=1
else:
non_seniors+=1
print(f'senior citizens:{senior_citizens} \n non seniors:{non_seniors}$)
Comments
Leave a comment