How to unpack a collection of data into variables

 If we have a collection of data in a list and we want to assign it to a set of variables we can do this in python, this concept is called unpacking.

See the bellow code:

fruits = ["web""healer""blog"]
x, y, z = fruits
print(x)
print(y)
print(z)


Admin

A Software Engineer, Social Media Marketing Expert, writer,

Post a Comment

Previous Post Next Post