How do I check if a number is greater than another number, then store it as a variable

Question:

I have the python code that asks the question about the users age, but I also need it to check if the user is above 18 and then store if they are 18 or not in a variable.

I have the basic age = int(input('What is your age?: '))
set up but now I need it to check if the user is above 18 and then to store a yes or no type of value, as in yes they are above 18 or no that they arent, then I would need to print an acceptance or denial, no if they are not 18 or above and yes if they are.

Asked By: user21357279

||

Answers:

accepted = 'yes' if int(input('What is your age?: ')) >= 18 else 'no'
print(accepted)

UPDATE (more verbose…as requested)

age = int(input('What is your age?: '))
accepted = age >= 18
print('yes' if accepted else 'no')
Answered By: EvilSmurf
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.