So this is what I'm trying to work with. I want Yes and No to both equal the same thing and end the loop (that I haven't started yet), though when something is typed in that isn't Yes or No it loops the question again until yes or no is inputed. I'm having trouble figuring out how to do this part, I'm still learning and while loops are new ground for me.
I'm using 2.7
d1 = raw_input('Please answer with Yes or No.\n')
if d1 == 'Yes':
print('Good, let\'s begin.')
elif d1 == 'No':
print('Good, let\'s begin.')
if d1 == 'yes':
print('Good, let\'s begin.')
elif d1 == 'no':
print('Good, let\'s begin.')
else:
ps('Mmmmm...')
Try this:
while True:
d1 = input('Please answer with Yes or No.\n')
if d1.lower() in ('yes', 'no'):
print('Good, let\'s begin.')
break
else:
print('MMMMmm')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With