immutable & tuples
please explain those topic with programming which is written above
To expand on the really good technical answers already posted here, I thought I'd share a way to make this word make more sense, based on what you already know about other words. One way to remember the meaning of "immutable" is to first associate the word "mutable" with the word "mutate". Think X-Men "mutants", Teenage "Mutant" Ninja Turtles, or how you might have called your sibling a "mutant freak" when arguing as kids. 😂 These all apply to being different or having changed from some other form. Now, if you know that "mutate" means "to change", then "mutable" means "can be changed" or "is changeable". Next, it helps to know that the latin prefix "im" negates the root word that follows to carry an opposite meaning. Examples of words with the "im" prefix: - impossible means not possible - impatient means not patient - imperfect means not perfect - impolite means not polite This pattern can be applied to many other words, such as, immoral, imbalance, impotent, and so on and so forth. Therefore, "immutable" means "not mutable", or rather, as established earlier, "not changeable". Hopefully, with this rather boring pseudo-etymology lesson, the word "immutable" will now sound less strange and more familiar.
An immutable object is one that cannot be changed once it is created. A tuple is a list(in a way) that you cannot alter once created, that is you cannot add elements to it and you cannot change the value of existing elements. Example: tuple_a = (1, 2, 4) tuple = 9#This is not allowed!
Please add Python as a tag in your question
immutable means unable to modify or delete(unchaged) tuple in python is read only.we can declare tuple only once. after that ,not possible to update or delete values of tuple . ch=('a','b','c') print(ch) print(ch) #gives error,unable to modify ch.append('d') #gives error,unable to delete del ch
Free month of PRO subscription
Hash in python
What's the problem?
Unable to overload +
Package of the Java
Please help me with HTML