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