- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is tuple unpacking in Python?
Before defining tuple unpacking we need to understand what is tuple.
Tuple : In Python tuples are used to store immutable object.A tuple is a sequence of immutable Python objects. Tuples are sequences, the tuples cannot be changed and tuples use parentheses. it assigns (RHS)right hand side of values into (LHS)Left hand side. In other way it is called unpacking of a tuple of values into a variable. In unpacking of tuple number of variables on LHS should be equal to number of values in given tuple. In packing, we put values into a new tuple while in unpacking we extract those values into a single variable.
Example 1
tuple = ("Tutorials Point", 132, "Employees") # tuple packing (companyname , Employerscount ,Information) = tuple # tuple unpacking print(companyname) print(Employerscount) print(Information)
Output
Tutorials Point 132 Employees
Example 2
tuple = ("RRS College of Engg and Technology", 6000, "Engineering") # tuple packing (college, student, graduates) = tuple # tuple unpacking # print college name print(college) # print no of student print(student) # print type of college print(graduates)
Output
RRS College of Engg and Technology 6000 Engineering
- Related Articles
- Unpacking a Tuple in Python
- Unpacking tuple of lists in Python
- Packing and Unpacking Arguments in Python?
- What is syntax of tuple declaration in Python?
- Check if variable is tuple in Python
- Test if tuple is distinct in Python
- Flatten tuple of List to tuple in Python
- What is the difference between a python list and a tuple?
- What is the difference between a python tuple and a dictionary?
- Tuple Division in Python
- Tuple multiplication in Python
- What is Tuple ID Propagation?
- Check if element is present in tuple in Python
- Tuple Data Type in Python
- Delete Tuple Elements in Python

Advertisements