Concatenation

Python allows us to join tuples using the concatenation operator depicted by symbol + .

Example:

Tuple concatenation - Example - Teachoo.png

Repetition

Repetition operation is depicted by the symbol *. It is used to repeat elements of a tuple. 

The repetition operator requires the first operand to be a tuple and the second operand to be an integer only.

Example:

Tuple Repetition - Example - Teachoo.png

Membership

In operator

The in operator checks if the element is present in the tuple and returns True , else it returns False.  

Example:

Tuple - In operator - Example - Teachoo.png

Not in operator

The not in operator returns True if the element is not present in the tuple, else it returns False.

Example:

Tuple - Not in operator - Example - Teachoo.png

Slicing

Tuple slicing creates a new tuple from an old one.

The slice operator allows you to specify where to begin slicing, where to stop slicing, and what step to take. 

Syntax:

tuple[Start : Stop : Stride]

Examples:

Tuple Slicing - Examples - Teachoo.png

Go Ad-free
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science and Computer Science at Teachoo