0 out of 464 challenges solved
Write a Python function `square_nums(nums)` that takes a list of integers `nums` as input and returns a new list containing the squares of each element in the input list. #### Example Usage ```python [main.nopy] print(square_nums([1, 2, 3, 4, 5])) # Output: [1, 4, 9, 16, 25] print(square_nums([10, 20, 30])) # Output: [100, 400, 900] print(square_nums([12, 15])) # Output: [144, 225] ``` #### Constraints - The input list will only contain integers. - The function should return a new list without modifying the original list.
def square_nums(nums): """ Given a list of integers, return a new list containing the squares of each element. Args: nums (list): A list of integers. Returns: list: A list containing the squares of the input integers. """ # Placeholder for the solution pass