
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
Basic Tuples Operations in Python
Tuples respond to the + and * operators much like strings; they mean concatenation and repetition here too, except that the result is a new tuple, not a string.
In fact, tuples respond to all of the general sequence operations we used on strings in the prior chapter −
Python Expression | Results | Description |
---|---|---|
len((1, 2, 3)) | 3 | Length |
(1, 2, 3) + (4, 5, 6) | (1, 2, 3, 4, 5, 6) | Concatenation |
('Hi!',) * 4 | ('Hi!', 'Hi!', 'Hi!', 'Hi!') | Repetition |
3 in (1, 2, 3) | True | Membership |
for x in (1, 2, 3): print x, | 1 2 3 | Iteration |
- Related Articles
- Basic List Operations in Python
- Basic Operations for Queue in Data Structure
- Basic operations and Working of LOB
- Basic Operations supported by a list in Javascript
- Combining tuples in list of tuples in Python
- C# Program to perform all Basic Arithmetic Operations
- Explain the basic mathematical operations on irrational numbers.
- Count tuples occurrence in list of tuples in Python
- Updating Tuples in Python
- Compare tuples in Python
- Java Menu Driven Program to Perform Basic String Operations
- How to Concatenate tuples to nested tuples in Python
- Remove duplicate tuples from list of tuples in Python
- Explain the basic mathematical operations by using 2y and 5.
- Remove matching tuples in Python

Advertisements