Posted By

iamok on 05/06/09


Tagged

lists looping


Versions (?)

list comprehension


 / Published in: Python
 

  1. def main():
  2. print [func(x) for x in range(10)]
  3. print map(func,range(0,10))
  4.  
  5. def func(x):
  6. return x**2
  7.  
  8. if __name__ == '__main__':
  9. main()

Report this snippet  

You need to login to post a comment.