Answers for "difference between list and tuple in python"

10

python tuple vs list

#tuples and lists are the same thing, but a tuple cannot be changed
tup = (1,'string',True)
lst = ['hiya',23545,None]
Posted by: Guest on March-26-2020
0

difference between lists and tuples in python

#to create a tuple you use ( ) :
myTuple = ()
#but to create a list you use [ ] :
myList = []
#tuples cannot be changed while the lists can be modified but Tuples are
#more memory efficient
Posted by: Guest on November-20-2021

Code answers related to "difference between list and tuple in python"

Python Answers by Framework

Browse Popular Code Answers by Language