Source Code:
(back to article)
old_list = [1, 2, 3, 4, 5] new_list = [x**2 for x in old_list] print(new_list) # Output: [1, 4, 9, 16, 25]
Result:
Report an issue