Advertisement
here2share

# map_like_loop.py

Jul 14th, 2017
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. # map_like_loop.py
  2.  
  3. import math
  4. data=[289,256,225,196,169,144]
  5. def square_root(num):
  6.     return math.sqrt(num)
  7. square_root_list=list(map(square_root,data))
  8. print "The square root of the numbers respectively:",square_root_list
  9.  
  10. # >>> 'The square root of the numbers respectively:', [17.0, 16.0, 15.0, 14.0, 13.0, 12.0]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement