python square all numbers in list
def square(list):
return [i ** 2 for i in list]
python square all numbers in list
def square(list):
return [i ** 2 for i in list]
list square python
l1 = [1,2,3,4,5]
l2 = [x**2 for x in l1]
l2
>>> [1,4,9,16,25]
list comprehension with square numbers python
def square(a):
squares = []
for i in a:
squares.append(i**2)
return squares
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us