Advertisement
Guest User

Untitled

a guest
Dec 29th, 2011
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. hi = ['hi', 'hello']
  2. x = 0
  3. def hi():
  4.     print hi[x]
  5.  
  6. for l in range(2):
  7.     hi()
  8.     x = 1
  9.  
  10.  
  11. ---------------------------
  12.  
  13. >>> ================================ RESTART ================================
  14. >>>
  15.  
  16. Traceback (most recent call last):
  17.   File "C:/Python26/text3.py", line 7, in <module>
  18.     hi()
  19.   File "C:/Python26/text3.py", line 4, in hi
  20.     print hi[x]
  21. TypeError: 'function' object is unsubscriptable
  22. >>>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement