fork(1) download
  1. list = []
  2.  
  3. def dic(num):
  4. print(num)
  5.  
  6. return {
  7. 0 : addList,
  8. 1 : addList2
  9. }.get(num)
  10.  
  11. def addList():
  12. list.append(1)
  13.  
  14. def addList2():
  15. list.append(2)
  16.  
  17. for i in range(3):
  18. dic(0)
  19.  
  20. print(list)
Success #stdin #stdout 0.02s 8996KB
stdin
Standard input is empty
stdout
0
0
0
[]