0 votes
in Python by
What is the major difference between tuples and lists in Python?

1 Answer

0 votes
by
There are several major differences between tuples and lists in Python, which include the following:

Tuples

Tuples are similar to a list, but they are enclosed within parenthesis, unlike the list.

The element and size can be changed.

They cannot be updated.

They act as read-only lists.

Tuples are surrounded by ( )

Example of Tuple Code is, tup = (1, "a", "string", 1+2)

Lists

The list is used to create a sequence.

The element and size cannot be changed.

They can be updated.

They act as a changeable list.

Lists are surrounded by [ ]

Example of Lists Code is, L = [1, "a" , "string" , 1+2]

Related questions

0 votes
asked Feb 10, 2021 in Python by SakshiSharma
0 votes
asked Sep 23, 2023 in Dot Net by Robin
0 votes
asked Aug 22, 2022 in Python by Robindeniel
...