Tuple in Python Class 11 Notes : Easy Notes for CBSE Students

Introduction to Tuples in Python

Hey Class 11-12 CBSE students! Welcome to your easy notes on Tuples in Python—a key topic in your Computer Science syllabus. A tuple is like a list, but you cannot change its elements after creating it. It’s a simple way to store multiple items in a single variable. Let’s dive into this topic with examples, exercises, and tips to make it super easy for you!

 

Why Learn Tuples?: Tuples are faster than lists, great for storing fixed data, and often used in Python programming for CBSE projects.

Keywords: Tuple in Python, Python for Class 11, CBSE Computer Science, Python tuple notes.

What is a Tuple in Python?

A tuple is a collection of items in Python that is immutable (cannot be changed). It’s created using round brackets (). Think of it as a read-only list!

Syntax:

  my_tuple = (item1, item2, item3)

  Example:

  subjects = (“Maths”, “Science”, “English”)

  print(subjects)

  Output:

  (‘Maths’, ‘Science’, ‘English’)

 

Key Point: You can’t add, remove, or change items in a tuple after creating it.

 

Features of Tuples in Python for Class 11

Here are the main features of tuples that every CBSE student should know:

Immutable: Once created, you cannot change the items.

Ordered: Items have a fixed order, and you can access them using their index.

Allows Duplicates: You can have the same item multiple times.

Heterogeneous: Can store different data types (e.g., numbers, strings).

Example:

mixed_tuple = (1, “Hello”, 3.14, 1)

print(mixed_tuple)

 

Output:

  (1, ‘Hello’, 3.14, 1)

 

Creating a Tuple in Python

There are different ways to create a tuple in Python. Let’s look at them:

 

1. Using Round Brackets:

   fruits = (“apple”, “banana”, “orange”)

   print(fruits)

 Output: (‘apple’, ‘banana’, ‘orange’)

 

2. Tuple with One Item (Use a comma!):

   single_item = (“apple”,)  # Correct

   not_tuple = (“apple”)    # Wrong (this is a string)

   print(type(single_item))

   Output: <class ‘tuple’>

 

3. Using tuple() Constructor:

   numbers = tuple([1, 2, 3])

   print(numbers)

  

Output: (1, 2, 3)

 

Accessing Tuple Elements in Python

You can access tuple items using their index (starts from 0).

Example:

  colors = (“red”, “blue”, “green”)

  print(colors[1])  # Access second item

 

Output: blue

 

Negative Indexing: Use negative numbers to access from the end.

  print(colors[-1])  # Last item

  Output: green

Slicing: Get a range of items.

print(colors[0:2])  # First two items

Output: (‘red’, ‘blue’)

 

Operations on Tuples for CBSE Class 11

Even though tuples are immutable, you can perform some operations:

1. Concatenation (+): Join two tuples.

   tuple1 = (1, 2)

   tuple2 = (3, 4)

   result = tuple1 + tuple2

   print(result)

  

  Output: (1, 2, 3, 4)

 

2. Repetition (*): Repeat a tuple.

   tuple1 = (“Hi”,)

   print(tuple1 * 3)

  

  Output: (‘Hi’, ‘Hi’, ‘Hi’)

 

3. Membership (in): Check if an item exists.

   fruits = (“apple”, “banana”)

   print(“apple” in fruits)

   Output: True

 

Tuple Functions and Methods Table for Class 11

Tuples come with some useful built-in functions and methods that you can use. Here’s a table to help you understand them:

Function/Method Description Example Code Output
len() Returns the number of items in a tuple my_tuple = (1, 2, 3) print(len(my_tuple)) 3
count() Counts how many times an item appears numbers = (1, 2, 2, 3) print(numbers.count(2)) 2
index() Returns the index of the first occurrence of an item numbers = (1, 2, 3) print(numbers.index(2)) 1
min() Returns the smallest item in a tuple numbers = (5, 2, 8) print(min(numbers)) 2
max() Returns the largest item in a tuple numbers = (5, 2, 8) print(max(numbers)) 8
sum() Adds all items in a tuple (works for numbers) numbers = (1, 2, 3) print(sum(numbers)) 6

 

Tip for CBSE Students: Practice these functions in your practical exams—they’re easy marks!

Advantages of Tuples for CBSE Students

Fast: Tuples are faster than lists—great for large data.

Safe: Since they can’t be changed, they prevent accidental updates.

Memory Efficient: Use less memory than lists.

 

Exercises for CBSE Class 11 Students

Let’s practice what you’ve learned!

Question 1: Create a tuple of your favorite subjects and print the second subject.

Question 2: Write a program to find the length of the tuple marks = (90, 85, 88, 92).

Question 3: Use max() to find the highest mark in the tuple marks = (90, 85, 88, 92).

 

Solutions (Try First!):

# Question 1

subjects = (“Maths”, “Science”, “English”)

print(subjects[1])  # Output: Science

 

# Question 2

marks = (90, 85, 88, 92)

print(len(marks))  # Output: 4

 

# Question 3

marks = (90, 85, 88, 92)

print(max(marks))  # Output: 92

 

CBSE Exam Tips for Python Tuples

Class 11 Focus: Understand tuple creation, indexing, and operations for practical exams.

Common Questions: “Create a tuple and access its elements” or “Explain immutability of tuples.”

Mistake to Avoid: Don’t forget the comma for single-item tuples—(“apple”,) is correct, (“apple”) is not!

 

Frequently Asked Questions (FAQ)

What is a tuple in Python for Class 11? 

  A tuple is an immutable collection of items, created using () brackets.

Why are tuples immutable? 

To make them safe and fast for storing fixed data.

What are tuple functions in Python?

Functions like len(), count(), index(), min(), max(), and sum() work with tuples.

 

Copywrite © 2020-2025, CBSE Python,
All Rights Reserved
error: Content is protected !!