Difference between tuple and list in python

monday_temperatures=(1,4,5)
>>> monday_temperatures2=[1,4,5]
>>> monday_temperatures2.append(7)
>>> monday_temperatures2
[1, 4, 5, 7]
>>> monday_temperatures2.remove(4)
>>> monday_temperatures2
[1, 5, 7]
>>> monday_temperatures.append(7)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'tuple' object has no attribute 'append'

 

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published. Required fields are marked *