Quick actions

cmd+k|ctrl+k

Navigation

Languages

Python Web-L07(packing & unpacking)

Snippet info

Language

Python

Visibility

public

Author

victormakwaitat

Created

2025-02-12T09:11:16.470374Z

Updated

2025-02-12T09:33:10.209074Z

a, b, c = 1, 2,"hello"
print(a, b, c)

a,b,c = 'abc'
print(a,b,c)

for i in 'abc':
    print(i)
    
a,b = 1,2
b,a = a,b
print(a,b)

#unpack dictionary
# Dictionary is order
d = {'k1': 1, 'k2': 2, 'k3' : 3}
for i in d:
    print(i)
# Set is unorder
s = {'a', 1, 2, 3, 'b'}
for i in s:
    print(i)
a,b,c,d,e = s
print(a,b,c,d,e)
INFO