Skip to content

Files

Latest commit

 

History

History

Tuples

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Tuples

  • Tuples are very similar to lists, except that they are immutable (they cannot be changed).

  • Also, they are created using parentheses ( ), rather than square brackets.

  • Example:

      my_tuple = ("one", "two", "three")
    
  • You can access the values in the tuple with their index.

  • Trying to reassign a value in a tuple causes an error.

  • Tuples can be created without the parentheses by just separating the values with commas.

  • Example:

      my_tuple = "one", "two", "three"