python square a list code example
Example 1: python square all numbers in list
def square(list):
return [i ** 2 for i in list]
Example 2: list comprehension with square numbers python
def square(a):
squares = []
for i in a:
squares.append(i**2)
return squares