Write a python function that squares every number in a list using a list comprehension and returns the result


Topic: Write a python function that squares every number in a list using a list comprehension and returns the result

Solution

def square_numbers(nums):
   return [i*i for i in nums]



List all Python Programs