Pack and unpack

def f(x) :
    return x**2 x**3

f(3) # return a tuple (9,27)
Copy the code
numbers =[1.2.3]
names =["xiaoming"."xiaohong"."xiaobai"]
a = list(zip(numbers,names))
# to get a list of list elements as tuples: [(1, "xiaoming"), (2, "xiaohong"), (3, "xiaobai"),]
for number,name in a:
    print(number,name)


    
Copy the code