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)
Learn Web Technologies for Free. Learn C#, LINQ, ASP.NET MVC, .NET Core, jQuery, JavaScript, Angular, Node.js, HTTPS, Python, Sass, D3.js, and many more latest technologies using easy tutorials.
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)
No comments:
Post a Comment