import random
while True:
name=input('What is your name?:')
print(name 'sir', 'hello?')
dice=random.randint(1,6)
if dice==1:
print ('.'.')
elif dice==2:
print('n.')
elif dice==3:
print('.'.')
elif dice==4:
print('h.')
elif dice==5:
print ('a')
else:
print('b.')
print ('Thank you.')
input('Do you want to stop the system?')
if answer=='Y'or'y':
break
elif answer=='N'or'n':
continue
I want to return to the beginning only when I enter 'N' or 'n' at the end of this code, but what should I enter other than continue?
python
"""
if answer=='Y'or'y':
break
elif answer=='N'or'n':
continue
"""
# 1
if answernot in ['N', 'n']:
break
# 2
if answer != 'N' and answer != 'n':
break
# 3
if answer.upper() != 'N':
break
# 4
if answer.lower() != 'n':
break
© 2024 OneMinuteCode. All rights reserved.