Python Tuples

(Sponsors) Get started learning Python with DataCamp's free Intro to Python tutorial. Learn Data Science by completing interactive coding challenges and watching videos by expert instructors. Start Now!

In Python Tuples are very similar to list but once a tuple is created, you cannot add, delete, replace, reorder elements.

Note: Tuples are immutable.

Creating a tuple

Tuples functions

Functions like max , min , len , sum  can also be used with tuples.

Iterating through tuples

Tuples are iterable using for loop [ Learn more about for loop here ] .

Slicing tuples

Slicing operators works same in tuples as in list and string.

in  and not in  operator

You can use in  and not in  operators to check existence of item in tuples as follows.

In next chapter we will learn about python data type conversion.

Other Tutorials (Sponsors)

This site generously supported by DataCamp. DataCamp offers online interactive Python Tutorials for Data Science. Join over a million other learners and get started learning Python for data science today!

3 thoughts on “Python Tuples

  1. kylen Crawford

    I dont understand how this works [0:2]. If the tuples are (11,22,33,44,55) the 0 place should be 11 but the 2 should be 33, i don’t understand why the program sends back (11,22)

  2. Pingback: Python Dictionaries - The Python Guru

Leave a Reply

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