If it's not m or f, repeat prompt until it's either or. I typed m or f, but the loop keeps repeating. Why?
gender = input('m/f? ')
while gender != 'm' or gender != 'f':
print("Type 'm' or 'f'")
gender = input('m/f? ')
if gender == 'm':
gender = 'him'
elif gender == 'f':
gender = 'her'
print("It read {}".format(gender))
Aucun commentaire:
Enregistrer un commentaire