Test for answers in an IF block [duplicate]

Write

response = input('Would like to …?').lower()

if response == 'y' or response == 'yes':
    …

Or

if response in ['y', 'yes']:
    …

Note that it’s not necessary to call str — your object is already a string.

Leave a Comment