I am trying to minimize as much as possible my coding and trying to solve problems in different ways and i wrote this code which gets a list of numbers and it returns the square root of each one number in list
def square_roots(l):
squareRoots = []
result = [squareRoots.append(math.sqrt(i)) for i in l]
return result
l=[1,2,3]
print(square_roots(l))
The only problem is that it returns [None, None, None]
instead of the square root of each number in the array.
What's wrong with it?