Advertisement
Guest User

Untitled

a guest
Aug 27th, 2015
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. multiply_by = []
  2. for i in range(11):
  3. def multiply_by_i(x):
  4. return i * x
  5. multiply_by.append(multiply_by_i)
  6.  
  7. >>> multiply_by[1](1)
  8. 10
  9. >>> multiply_by[4](5)
  10. 50
  11.  
  12. def multiply_by_i(i):
  13. def multiply_by_x(x):
  14. return i * x
  15. return multiply_by_x
  16.  
  17. multiply_by = []
  18. for i in range(11):
  19. multiply_by.append(multiply_by_i(i))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement