Computer Science, asked by kumarsidhartha, 5 months ago


Write a python program that reads a list L1 and Create another
list L2 that stores list
of tuples where each tuple is pair
of number & its square. If L1 in (1,2,3,4] then I will be
L2(1,1), (2,4), (3,9), (4, 16)

Answers

Answered by sam241726
0

Explanation:

input-

L1=[1,2,3,4]

L2=[(val, pow(val, 2)) for val in L1]

print("L2=",L2)

output-

L2=[(1,1),(2,4),(3,9),(4,16)]

thanks

Attachments:
Similar questions