1# locals referenced before assignment 2 3def f1(): 4 print(x) 5 x = 1 6 7def f2(): 8 for i in range(0): 9 print(i) 10 print(i) 11 12def check(f): 13 try: 14 f() 15 except NameError: 16 print("NameError") 17 18check(f1) 19check(f2) 20