how to print square numbers in list python 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