for with flag
names = ['Foo', 'Bar', 'Baz']
ok = False
for i in range(3):
name = input('Your name please: ')
if name in names:
ok = True
break
if not ok:
print("Not OK")
exit()
print("OK....")
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
names = ['Foo', 'Bar', 'Baz']
ok = False
for i in range(3):
name = input('Your name please: ')
if name in names:
ok = True
break
if not ok:
print("Not OK")
exit()
print("OK....")