Skip to content

Latest commit

 

History

History
20 lines (13 loc) · 472 Bytes

mutability.md

File metadata and controls

20 lines (13 loc) · 472 Bytes

Mutability

  1. Explain mutability

  2. Give an example of 2 data types which are mutable an 2 immutable

  3. Mutability in Python refers to whether the value of certain type can be changed or not. For example, let's say you defined the following variable: x = 2017 If you'll add 5 to it, the result is a completely different object because integers in Python are immutable: x = 2017 + 5

Mutable:

  • List
  • Dictionary

Immutable:

  • Integer
  • String