What is the difference between tuple and list in python?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 16

What is the difference between tuple and list in python??

14th Jan 2018, 1:43 AM
Ankit Saxena
Ankit Saxena - avatar
12 Answers
+ 4
hello! its a very nice question, most of people often have the same query. and i myself had the same question when i started Python. ... for being a little bit funny....😂the difference is in the syntax declaration. important differences. in pyhton there are 3 main sets method namely 1. List 2. Tuple 3. Dictionary as per your question List in Python is mutable [mean the data in list can be modified during the program.] where as.. Tuple in Python follow immutability (means once the values are allocated to the index it cant be changed throughout the program.) and in regards for dictionary which have not asked, if you need any help there i will be happy to help you there. thank you.
22nd Jan 2018, 8:29 AM
Gajendra lohar
Gajendra lohar - avatar
+ 8
1) List in Python can be edited... as we can use append function in list to add new items in the list. On the other hand we cannot use append function in case of Tuple. 2) We cannot use del function to delete any part of the Tuple but we can use del function to delete any part of the list in Python. If you need furthur help then ask.
14th Jan 2018, 2:05 AM
Rahulllkumarrr
Rahulllkumarrr - avatar
14th Jan 2018, 8:06 AM
visph
visph - avatar
+ 2
Tuple is a list that cannot be modified (No adding, removing or replacing elements of a tuple).
15th Jan 2018, 2:14 AM
Margesh Phirke
Margesh Phirke - avatar
+ 1
They are varied in their literal,size,operation and usage LITERAL: e.g. egtuple=(1,2) eglist=[1,2] SIZE: e.g. a=tuple( range(1000)) #8024-->>So,tuples are small,fast b=list(range(1000)) #9088 OPERATION: You can't delete or sort a tuple USAGE: List is mutable Tuple can be used as a key in dictionary
7th Feb 2018, 12:03 PM
Malarkodi
Malarkodi - avatar
0
tuple can't edite
14th Jan 2018, 3:05 PM
kim wu
kim wu - avatar
0
As others said, the tuples are immutable types and cannot be changed once created.
15th Jan 2018, 8:19 AM
Etem Hyusnev
Etem Hyusnev - avatar
0
Tuples are constant data types that can't be manipulated nor changed. lists can be. They can each serve different types of functions within your data structure.
16th Jan 2018, 2:35 AM
EternalWisdom
EternalWisdom - avatar
0
tuples are immutable while list are
12th Feb 2018, 5:35 PM
Olanrewaju Yusuf
Olanrewaju Yusuf - avatar
0
tuple can changed but list are permanent it can't be changed tuples is denoted in (. ) list is denoted in [. ]
23rd Apr 2018, 10:45 AM
Pragati Mahajan
Pragati Mahajan - avatar
0
What could be described as an immutable list?
31st Jan 2023, 3:10 PM
Om Patel
Om Patel - avatar
- 3
What could be described as an immutable list?
16th Jul 2018, 9:13 AM
Rola Khushbuben
Rola Khushbuben - avatar