Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
277 B
2
Indexable
Never
def square_list(numbers):
    squared_numbers = []
    for num in numbers:
        squared_numbers.append(num ** 2)
    return squared_numbers

# Example usage:
numbers = [1, 2, 3, 4, 5]
squared_numbers = square_list(numbers)
print(squared_numbers)  # Output: [1, 4, 9, 16, 25]
Leave a Comment