for with flag
examples/advanced/for_with_flag.py
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....")
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....")