719025856 by Unknown

719025856 by Unknown

Language: eng
Format: epub

You can’t change the value of an item in a tuple using this kind of syntax:

prices[1] = 234.56

You’ll get an error message that reads TypeError: 'tuple' object does not support item This message is telling you that you can’t use the assignment operator, to change the value of an item in a tuple because a tuple is immutable, meaning its content cannot be changed.

Any method that alters, or even just copies, data in a list causes an error when you try it with a tuple. So the list methods and .sort() would fail when working with tuples. In short, a tuple makes sense if you want to show data to users without giving them any means to change any of the information.


Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.