Advertisement
ancestor_tunji

#question 7

Feb 28th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.23 KB | None | 0 0
  1. #question 7
  2. values = [3.45, 5.67, 7.89]
  3. #using list comprehension
  4. squares = [value **2 for value in values]
  5. print(squares)
  6.  
  7. print()
  8. #using map function
  9. def squares(number):
  10.     return number** 2
  11. print(list(map(squares, values)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement