Python Trap
# UnboundLocalError
1234567891011121314151617181920212223242526272829a = 1def func(): a += 1 print(a)func()# UnboundLocalError: local variable 'a' referenced before assignmentimport randomdef func(ok): if ok: a = random.random() else: import random a = random.randint(1,10) return...
more...