Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (12.7k points)

List assignment:

[a,b]=[1,2]

Tuple assignment:

a,b=[1,2]

I don't perceive any distinction in the consequence of these two sorts of tasks, is there any distinction I don't have a clue yet? 

In the event that there isn't, the reason would they say they are called various names?

1 Answer

0 votes
by (26.4k points)

They do exactly the same thing. A tuple is a perused just form of a list. As a rule, you use enclosures/parentheses (a, b) to make tuples versus square sections [a, b] for records/lists, however, the brackets can in some cases be overlooked. You could likewise compose:

(a,b) = [1,2]

Or, perhaps most common:

a,b = 1,2

Interested to learn the concepts of Python in detail? Come and join the python course to gain more knowledge in Python

Watch this video tutorial, if you want to gain more information

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
2 answers
asked Sep 17, 2019 in Python by Sammy (47.6k points)
0 votes
1 answer

Browse Categories

...