CBSE 2026 results are out, Mukul scored a perfect 100/100 in Computer ScienceSee all toppers →

KwickAcademy Python · 8 min · free

Tuples: Operations, Methods and Tuple Assignment

8 min5 KwickClipsFull text belowFree
Next lesson →Kajal Ma'am (MCA), teaching since 2004Remembered in this browser

Learn Python tuples for CBSE Class 11: tuple vs list, creating tuples, operations, count and index, tuple assignment, programs. A tuple is an ordered group of values in round brackets, and it is immutable, so it can never change after it is made.

Follows the syllabus of: CBSE Class 11 Computer Science (083), CBSE Class 11 Computer Science Essentials (083), CBSE Class 10 Artificial Intelligence (417)

On screen in this lesson

Tuple vs list

FeatureListTuple
Brackets[1, 2, 3](1, 2, 3)
Can change?Yes, mutableNo, immutable
Index and sliceYesYes
MethodsManycount, index

Why immutability is useful

Fixed data stays safe from accidental changes
A tuple of fixed values can be a dictionary key; a list cannot
A tuple uses a little less memory than a list
It tells readers: this data should not change

Quick recap

A tuple uses ( ) and can never change
One item needs a comma: (5,)
Index, slice, +, * and in work like a list
count and index are the only tuple methods
a, b = b, a is tuple assignment

Quick answers

Is (5) a tuple?

No, it is the number 5. A one-item tuple needs a comma: (5,).

What does sorted() return for a tuple?

A list in square brackets, not a tuple.

KwickClips from this lesson

Short clips, one idea each. Good for revision the night before.

The full lesson, in text

Hello students, welcome to Kwickprep. The days of the week never change. So why should your program allow anyone to change them by mistake? Python has a safe, locked container for such data, called a tuple. Today we will learn tuple operations, tuple methods, tuple assignment, and two exam programs.

A tuple is an ordered group of values, just like a list, with one big difference. A list uses square brackets, while a tuple uses round brackets. A list is mutable, which means it can change, but a tuple is immutable, which means it can never change after it is made. Both keep order, so both allow indexing and slicing. A list has many methods, but a tuple has only two, count and index.

We create a tuple by putting values inside round brackets, separated by commas. The single equals sign stores it in a variable. Now pause and predict. Is five inside round brackets a tuple? No, it is just the number five. For a tuple with one item, you must add a comma after it. The type function proves it.

What if we try to change an item? Days at zero equals Sun is not allowed. Python stops with a type error, saying a tuple does not support item assignment. The data stays exactly as it was made.

Why would we want data that cannot change? First, fixed data like months, or the map location of a school, stays safe from accidental changes. Second, a tuple of fixed values can be a key in a dictionary, which you will meet later. A list cannot. Third, a tuple uses a little less memory than a list. Fourth, it tells anyone reading your code that this data should stay fixed.

Indexing and slicing work just like a list. Indexes start from zero, so marks at one is ninety five. Minus one is the last item, forty five. A slice from one to four gives indexes one, two and three, and the stop is never included. A step of minus one gives the tuple in reverse. Notice that a slice of a tuple is also a tuple.

The plus operator joins two tuple values into a new one, and this is called concatenation. The star operator repeats a tuple, and this is called repetition. The in operator checks membership, which means whether a value is present. Two is in first, so True. Nine not in first is also True. None of these change the old tuple, they make a new one.

Here are runs from four balls. Len gives the number of items, four. Count tells how many times a value appears, and four appears twice. Index gives the position of the first match, and six is at index one. The tuple function turns other values into a tuple. It turns the word hi into two letters, and a list into a tuple.

These built-in functions also work on a tuple. Sorted gives the values in order, but look closely. It gives back a list in square brackets, not a tuple. The tuple itself cannot be sorted, because it cannot change. Min gives the smallest, sixty, and max gives the largest, ninety five. Sum adds them, two hundred twenty seven.

Tuple assignment means giving each value of a tuple to its own variable, in one line. Name gets Riya, and age gets fifteen. The left side and the right side must have the same count, otherwise Python gives a value error. Commas alone also make a tuple, so five comma nine on the right is a tuple too. This also swaps two values easily. Left was five and right was nine. After the swap, left is nine and right is five.

A nested tuple is a tuple inside another tuple, like rows in a table. Toppers at one is the whole second row, Aman and eighty eight. Toppers at one, then zero, picks Aman from that row. In the loop, tuple assignment gives each row's two values to name and score. So it prints each topper with the marks.

Now the programs that exams ask. We start by treating the first mark as both the lowest and the highest. The loop checks every mark. If it is less than low, it becomes the new low. If it is greater than high, it becomes the new high. So low is forty five and high is ninety three. The mean, or average, is sum divided by len, which is seventy point zero. Min and max give the same answers, but exams often ask for the loop.

Linear search means checking items one by one, from the start, until we find the value we want. That value is called the key. First we read the tuple and the key. Then we take the first item. The diamond asks, is this item equal to the key? If yes, we print its position and stop. If no, the next diamond asks, are more items left? If yes, we take the next item and check again. If no items are left, we print Not found.

Here is linear search in Python. The variable pos starts at minus one, which means not found yet. The loop visits every index. Double equals compares two values, while one equals stores a value. When the item equals the key, sixty two, pos becomes two, and break stops the loop at this first match. Pause and predict. What prints if key is forty five, the very first item? Position zero. And if key is fifty, pos stays minus one, which means not found.

Let us revise what we learned today. A tuple uses round brackets and can never change. A tuple with one item needs a comma after it. Indexing, slicing, plus, star and in all work just like a list. Count and index are the only two tuple methods, and sorted gives back a list. Finally, swapping two variables in one line is tuple assignment. Try the search program with your own marks.

Courses that teach this

CourseUnit
CBSE Class 10 Artificial Intelligence (417)Part B Unit 7: Advance Python
CBSE Class 11 Computer Science (083)Computational Thinking and Programming - I
CBSE Class 11 Computer Science Essentials (083)Computational Thinking and Programming - I
Programming All levels PythonData Structures

Voice-over in this lesson is AI-generated. The script is written and checked by Kajal Ma'am. Boards can revise a syllabus mid-year, so confirm anything you plan around against the official board circular. Keep your passwords, OTPs and ID numbers to yourself — we never ask for them. To reach Kajal Ma'am, use the WhatsApp button; sharing your number there is how we call you back.

Free to watch, no sign-up. Live classes with Kajal Ma'am are the paid course; these lessons stay free either way.

Want a plan that actually fits your board dates?

Ask Kajal Ma'am directly, 20+ years teaching computer science. Free demo class first, no payment.

Talk to Kajal Ma'am on WhatsApp

Or see the Class 12 Computer Science course →

Studying outside India?

We coach CBSE, IGCSE & international students across the globe, one-to-one, in your local time zone.

Visit International →