[go: up one dir, main page]

0% found this document useful (0 votes)
62 views25 pages

10 Notes Tuples

The document discusses tuples in Python. It defines what tuples are, how they are created and used, built-in functions related to tuples like len(), tuple(), count(), etc. It also provides examples of tuple operations like indexing, slicing, accessing elements and linear search on tuples.

Uploaded by

Neha Parmanandka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views25 pages

10 Notes Tuples

The document discusses tuples in Python. It defines what tuples are, how they are created and used, built-in functions related to tuples like len(), tuple(), count(), etc. It also provides examples of tuple operations like indexing, slicing, accessing elements and linear search on tuples.

Uploaded by

Neha Parmanandka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

Tuple

CBSE Syllabus : 2021 22

Tuples: introduction, indexing, tuple operations (concatenation, repetition, membership


& slicing), built-in functions: len(), tuple(), count(), index(), sorted(), min(), max(),
sum(); tuple assignment, nested tuple, suggested programs: finding the minimum,
maximum, mean of values stored in a tuple; linear search on a tuple of numbers, counting
the frequency of elements in a tuple.

Tuple is a sequence of immutable objects. It is just like list.


(Dictionary is not a sequence)

A tuple can have different types of data items like integers, floating
point numbers etc.
tup1 = (‘comp sc', ‘info practices', 2017, 2018)

Difference between the tuples and the lists:


• the tuples cannot be changed like lists. So tuples are used to store data that is
not to be changed.
• Lists uses square bracket where as tuples use parentheses.

Strings and Tuples are immutable. Lists and Dictionary are mutable.

TUPLE
A tuple is enclosed in parentheses () for creation and each item is separated by a comma.
e.g.
tup1 = (‘comp sc', ‘info practices', 2017, 2018)
tup2 = (5,11,22,44)

The tuple are depicted through round brackets .Ex :

() empty tuple

(3) tuple with one number

(1,2,3) tuple of integers

(1,2.5,‘a’,2) tuple of mixed value types

(1,4,5,(7,8)) Nested Tuple


A tuple can also be created without using parentheses. This is known as tuple
packing.

my_tuple = 3, 4.6, "dog"

print(my_tuple)

Lets see through Program example how List is changeable and Tuple isn’t

#picnic is a List.and we change Crisps to Chips. We can do it.

picnic= ["ColdDrinks","Juices","Chocolates","Crisps","Nachos"]

picnic[3]= "Chips"

print(picnic) # will print ["ColdDrinks","Juices","Chocolates","Chips","Nachos"]

#tpicnic is a Tuple.and we change Crisps to Chips. We cannot do


it.Result in an error

tpicnic= ("ColdDrinks","Juices","Chocolates","Crisps","Nachos")

tpicnic[3]= "Chips" #will result into an error

print(picnic)

Accessing of Elements of Tuple

0 1 2 3 4 5 6 7 8
a b c d e f g h i
-9 -8 -7 -6 -5 -4 -3 -2 -1

If the above Tuple is T, then T[5] is ‘N’ and T[-11] is ‘P’

Lets take Tuple T = ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i') and see how Tuple slicing works

Code Output Explanation

('c', 'd', 'e', 'f', 'g') Prints T[2] to T[6]


print(T[2:7])
Prints starting from T[-7] till one
('c', 'd', 'e', 'f', 'g') before L[-2].
print(T[-7:-2])
Prints left to right only even if
negative index is there – stops one
before the last element

Prints starting from L[2] till one


('c', 'd') before L[-5].
print(T[2:-5])
Prints left to right only

('c', 'e', 'g') Prints L[2], L[4], L[6].


Has to stop one before L[7]
print(T[2:7:2])

('g', 'e', 'c') When Step size is in negative, it is


print(T[6:1:-2])
printed in reverse

Prints in reverse starting from L[6] ,


then L[4], then L[2].

('g', 'e') Prints in reverse starting from L[6] ,


print(T[6:2:-2])
then L[4].
Doesn’t print L[2] as has to stop
before
print(T[:3]) ('a', 'b', 'c') Starts from 0 index. Goes till 2
index. By default step size is 1.

Prints L[0], L[1], L[2].

('g', 'h', 'i') Prints starting from L[6] till end


print(T[6:])
element. Take default step size as 1

Prints starting from 0 index. Goes


print(T[::-1])
('i', 'h', 'g', 'f', till end. Takes step as -1.
'e', 'd', 'c', 'b', Prints starting from end to
'a') beginning
['a', 'b', 'c', 'd', Prints starting from L[0] to one
print(T[:-1:])
'e', 'f', 'g', 'h'] before L[-1] in steps of 1
or print(T[:-1])
If step not given then step is 1

Inputting a tuple
1. If we wish to enter elements through keyboard:
x= input("Enter elements of tuple ")
print(x)

t=tuple(x) # tuple function converts the above string into tuple


print(t)

Output:
Enter elements of tuple Responsibility
Responsibility (This is a String)
('R', 'e', 's', 'p', 'o', 'n', 's', 'i', 'b', 'i', 'l', 'i', 't', 'y') (This is a tuple now)

2) We can assign elements to a tuple:


tup1= (‘R’,’E’,’S’)
print(tup1)

Tuple Functions and Methods (Readymade)

1. The len() method – It returns length of the tuple, i.e. ,the count of elements
in the tuple.Ex:
>>>tp=(1,2,3)
>>>len(tp)
Output:
3
2. The max() method – It returns the element from the tuple having
maximum value.Ex:
>>>tp=(10,5,78)
>>>max(tp)
Output:
78
3. The min() method – It returns the element from the tuple having minimum
value. Ex:
>>>tp =(9,3,1)
>>>min(tp)
Output:
1
4. The index() method – It returns the index of an existing element of a tuple
(Starting index is 0) .Ex:
>>>t1=(3,4,5,6)
>>>t1.index(5)
Output:
2
5. The count() function – This method returns the count of a member
element in a given tuple. Ex:
>>>t1=(2,3,4,5,6,2,7,8,2)
>>>t1.count(2)
Output:
3
6. The tuple() method – It can be used to create tuples from different types of
values.
>>>t= tuple(“abc”)
>>>t
Output:
(‘a’, ‘b’, ‘c’) (See that output is a tuple, so it is enclosed in ( )-elements separated by commas )

7. The sorted() method- It is used to sort a tuple. Passing a tuple to sorted() returns a
sorted list.
t1 = (3, 1, 4, 5, 2)
x = sorted(t1)
print(t1)
print(x)

Output:
(3, 1, 4, 5, 2)
[1, 2, 3, 4, 5] see that the sorted method/function sorts the tuple and returns it as a list.

8. Sum() method- returns the sum of values of tuple.


>>> sum((1, 2, 3, 4, 5)) # sum values in a tuple
15
There are two (( used above as one ( is for tuple and other one is for function.

WAP to find maximum, minimum value , frequency(no of times) of an element in a


tuple

t=(3,5,7,2,5)

print("The Tuple t is: ")

print(t)

print(" Maximum element in the Tuple",max(t))

print(" Minimum element in the Tuple",min(t))

print(" Mean of elements in the Tuple",sum(t)/len(t))

x=int(input("Enter the element you want to search for "))

notimes= t.count(x)

if notimes ==0:

print("Element is not Present in the tuple")


else:

print("Element is present ",notimes," times")

Output:

The Tuple t is:

(3, 5, 7, 2, 5)

Maximum element in the Tuple 7

Minimum element in the Tuple 2

Mean of elements in the Tuple 4.4

Enter the element you want to search for 5

Element is present 2 times

Linear Search in a Tuple. (Search for an element in a Tuple without using count()

WAP to let the user enter an element. Search and display how many times it is
present in the tuple

t=(3,5,7,2,5)

print("The Tuple t is: ")

print(t)

c=0

x=int(input("Enter number to be searched for "))

L=len(t)
for i in range(0,L):

if(t[i]==x):

c=c+1

if (c==0):

print("Number being searched for is NOT present in the tuple")

else:

print("Number being searched for is present ",c," times in the tuple")

Output:

The Tuple t is:

(3, 5, 7, 2, 5)

Enter number to be searched for 5

Number being searched for is present 2 times in the tuple

Creating a tuple with one element is a bit tricky.

Having one element within parentheses is not enough. We will need a trailing comma to
indicate that it is, in fact, a tuple.
mytuple = (9)

print(type(mytuple)) # displays <class 'str'>

mytuple = (9,)

print(type(mytuple)) # displays <class 'tuple'>

mytuple = 9,
print(type(mytuple)) # displays <class 'tuple'>
Program
If we enter tuple with one element with input() and print the tuple, it displays the element with a
,(comma)
x= input("Enter elements of tuple ")
print(x)
t=tuple(x) # making string as tuple by using tuple function
print("The Tuple is: ")
print(t)
Output:
Enter elements of tuple 1
1
The Tuple is:
('1',)

How to change an element of a tuple?


We can convert the tuple into a List by using list()….Change the element of List and then
convert list back to tuple by using tuple()

#picnic is a List.and we change Crisps to Chips. We can do it.


picnic= ("ColdDrinks","Juices","Chocolates","Crisps","Nachos")
print(picnic)

#Changing picnic to a List named Lpicnic and changing Crisps to Chips

Lpicnic= list(picnic)
Lpicnic[3]="Chips"
print(Lpicnic)

#Changing Lpicnic back to tuple

picnic=tuple(Lpicnic)
print(picnic)

Program
Input elements of a Tuple (numbers) through keyboard. (We let the user enter
through keyboard, append them in a List. Then make that list into a Tuple)

L=[]
for i in range(0,5):
x=int(input("Enter a number "))
L.append(x)
tuple1=tuple(L)
print(tuple1)

Output:
Enter a number 23
Enter a number 34
Enter a number 45
Enter a number 6
Enter a number 2
(23, 34, 45, 6, 2)

Tuple Operations :

1. Traversing a Tuple – Traversing a tuple means accessing and


processing each element of the tuple.

Ex 1 :
>>>t=(‘p’,‘u’,‘r’,‘e’)
>>>for i in t:
print(t[i])
p
u
r
e

Ex 2: WAP to let the user enter a few integers in a tuple. Traverse the
tuple and display each element of tuple.
x= input("Enter elements of tuple ")
print(x)

t=tuple(x) # making string as tuple by using tuple function


print("The Tuple t is: ")
print(t)

print(" First Method of accessing each element of tuple")

for a in t:
print(a)

print("Second Method of accessing each element of tuple")


for i in range(0,len(t)):
print(t[i])

Output:

Enter elements of tuple Class11A


Class11A
The Tuple t is:
('C', 'l', 'a', 's', 's', '1', '1', 'A')
First Method of accessing each element of tuple
C
l
a
s
s
1
1
A
Second Method of accessing each element of tuple
C
l
a
s
s
1
1
A

2. Joining Tuple – The + operator, when used with two tuples, joins two
tuples.Ex:
>>>t1=(1,2,3)
>>>t2=(4,5)
>>>t1 + t2
(1,2,3,4,5)

3. Replicating Tuple – The * operator is used to replicate a tuple


specified number of times.Ex:
>>>t1=(1,2)
>>>t1*2
1212

• We can join a tuple using + and repeat a tuple using *.


• Both + and * operations result in a new tuple.
• Joining is also called Concatenation.

# Concatenation
# Output: (1, 2, 3, 4, 5, 6)
print((1, 2, 3) + (4, 5, 6))

# Repeat
# Output: ('Repeat', 'Repeat', 'Repeat')
print(("Repeat",) * 3)

Membership operator:
Working of membership operator “in” and “not in” is same as in a list
We can test if an item exists in a tuple or not, using the keyword in .

# Membership test in tuple


my_tuple = ('a', 'p', 'p', 'l', 'e',)

# In operation
print('a' in my_tuple) # will display True
print('b' in my_tuple) # will display False

# Not in operation
print('g' not in my_tuple) #will display True

Updating Tuples
Tuples are immutable,that’s why we can’t change the content of tuple.It’s alternate
way is to take contents of existing tuple and create another tuple with these contents
as well as new content.
E.g.
tup1 = (1, 2)
tup2 = ('a', 'b')
tup3 = tup1 + tup2
print (tup3)

Output :
(1,2,’a’,’b’)

Deleting Tuple/ Tuple Elements


• we cannot change the elements in a tuple.
• It means that we cannot delete or remove items from a tuple.
• Deleting a tuple entirely, however, is possible using the keyword del.

my_tuple = ('p', 'r', 'o', 'g', 'r', 'a', 'm', 'i', 'z')

# del my_tuple[3]is not possible as tuples are immutable

# Can delete an entire tuple


del my_tuple is valid

# Now if we print tuple we get the error :NameError: name


'my_tuple' is not defined

print(my_tuple)

Direct deletion of tuple element is not possible but shifting of required content after discard
of unwanted content to another tuple.
e.g.
tup1 = (1, 2,3)
tup3 = tup1[0:1] + tup1[2:]
print (tup3)
Output:
(1,3)
Adding element in tuple though tuple is immutable

Python tuple is an immutable object. Hence any operation that tries to modify it (like append) is not
allowed. However, following workaround can be used.

First, convert tuple to list by built-in function list().


You can always append item to list object.
1. We convert tuple to list using list() function
2. We add element to list
3. We convert the list back to tuple using tuple() function.

Then use another built-in function tuple() to convert this list object back to tuple.You can see new
element appended to original tuple representation.

Adding elements to tuple : Program to add 100 to a given tuple

>>> T1=(10,50,20,9,40,25,60,30,1,56)

>>> L1=list(T1)

>>> L1

[10, 50, 20, 9, 40, 25, 60, 30, 1, 56]

>>> L1.append(100)

>>> T1=tuple(L1)

>>> T1
Nested Tuples
Accessing elements from nested tuples
(10, 50, 20, 9, 40, 25, 60, 30, 1, 56, 100)
Double indexes are used to access the elements of nested tuple. The first index represents the element of main
tuple and the second index represent the element of the nested tuple.

my_data is a tuple.
In the following example, when I used my_data[2][1], it accessed the second element of the nested tuple.
Because 2 represented the third element of main tuple which is a tuple and the 1 represented the second
element of that tuple.

my_data = (1, "Steve", (11, 22, 33))

# prints 'v'
print(my_data[1][3])

# prints 22
print(my_data[2][1])
Output:

v
22

Questions

1. How many types of sequences are supported in Python? (Tip: some


ordering is there)
Ans: Three Types of Sequences are supported in python:
(i) String
(ii) List
(iii) Tuple
Tip : In Dictionary there is no ordering.
2. What are Python’s built-in core data types?
There are various data types in Python. Some of the important types are listed below.
Numbers (ii) String (iii) List (iv) Tuple (v) Dictionary

3. What do you understand by term -immutable?

Ans: Immutable types are those data types that can never change their value . In Python the following
types are immutable:
(i) integers
(ii) floating-point numbers
(iii) Booleans
(iv) Strings
(v) Tuples
4. If a is (1, 2, 3), what is the difference (if any) between a*3
and [a, a, a]?

Ans: a*3 is different from [a,a,a] because, a*3 will produce a tuple (1,2,3,1,2,3,1,2,3) and
[a, a, a] will produce a list of tuples [(1,2,3),(1,2,3),(1,2,3)].
5. If a is (1, 2, 3), is a *3 equivalent to a + a + a?
Ans: Yes both give (1,2,3,1,2,3,1,2,3)
6. If a is (1, 2, 3), what is the meaning of a [1:2] = 4 and a [1:1]
= 4?
Ans: This will produce an error: TypeError: 'tuple' object does
not support item assignment
7. Does a slice operator always produce a new Tuple?
Ans: Yes
8. How is an empty Tuple created?
Ans: To create an empty tuple we have to write –
>>>T=() or >>>T=tuple()
9. How is a tuple containing just one element created?
Ans: Following methods may be used to create single valued
tuple –
>>>T=3, or >>>T=(4,)
10. What is (30,)?

Ans: (30) is an integer (if we leave just one integer in ()


its an integer while (30,) is a tuple.

Short Answer Type Questions


Q.1 How are Tuples different from Lists when both are sequences?
Ans: Tuples are similar to lists in many ways like indexing, slicing, and accessing individual values
but they are different in the sense that –
Tuples are immutable while lists are mutable.
List can grow or shrink while tuples cannot.

SN List Tuple

1 List elements are enclosed in []. Tuple elements are enclosed in ().

2 The List is mutable. The tuple is immutable.

3 The List has the a variable length because we can add The tuple has the fixed length.
or remove elements.

4 The list is used in the scenario in which we need to The tuple is used in the cases where
store the simple collections with no constraints where we need to store the read-only
the value of the items can be changed. collections i.e., the value of the
items cannot be changed. It can be
used as the key inside the
dictionary.

Q.2 Can tuples be nested?


Ans: Yes, tuples can be nested. e.g (23,34,(12,23,45))
Q.3 Discuss the significance of Tuples.
Ans: Tuples are great for holding static data that you don't plan on modifying and changing a lot. Tuples
are four to seven times faster than lists. This means for every list item manipulated, four to seven
tuples could be manipulated within that time frame. This has huge advantages for scientific work,
as this allows for speedy data reading.
Q.4 How can you say that a tuple is an ordered list of objects?
Ans: A tuple is an ordered list of objects. This is evidenced by the fact that the objects can be accessed
through the use of an index amd for a given index, same element is returned everytime.
Q.5 How can you add an extra element to a tuple?

Ans: Convert tuple into list and add or We can add an extra element to the tuple as follows –

>>>T = T +(9,) e.g.


Q.6 Find out the output generated by following code fragments:
(a) plane = (“Passengers”, ”Luggage”)

plane [1] = “Snakes”


(b) (a, b, c) = (1,2,3) (c) (a, b, c, d) = (1,2,3)
(d) a, b, c, d = (1,2,3) (e) a, b, c, d, e = (p, q, r, s, t) = t1

Ans:(a) TypeError: 'tuple' object does not support item assignment


(b) This will assign 1 to a, 2 to b and 3 to c.

(c) ValueError: not enough values to unpack (expected 4, got 3)


(d) ValueError: not enough values to unpack (expected 4, got 3)
(e) If tuple t1 has 5 values then this will assign first value of t1 in to a and p , next value to b and q and so on.
Q.7 Predict the output –
Ans: True

Q.8 Predict the output –


Ans: TypeError: 'tuple' object does not support item assignment

Skill Based Questions


Q.1 WAP that creates a tuple storing first 9 items of Fibonacci Series. Ans:

a=0
b=1 a=1
c=1 b=1
c= 2
Q.2 WAP that creates a third tuple after adding two tuples. Add second after first tuple.
Ans:
Q.3 WAP to calculate the mean of the numbers of the
tuple. Ans:
x=eval(input("Enter elements of tuple"))
y=tuple(x) #(1,2,3)
print(y)
L=len(y) # in example it will be 3
sum=0
for i in range(0,L):
sum=sum+y[i]
av=sum/L
print(av)

1. Write Python statements to create the following tuples:


(i) A tuple of 5 fruit names and name it as fruit.
(ii) A tuple of 5 city names and name it as City.
(iii) A tuple containing 3 strings and 2 integers and name it as Mixed.
(iv) A tuple containing 3 integers and a list of 2 strings and name it as Box.
(v) A tuple of 10 random integers each in the range 10 to 50 and name it as R10.
(vi) A tuple of 10 random floating-point numbers in the range 10.00 to 49.99 and name it as F10.
(vii) A tuple of 10 values of the expression x 2+2x-1, for integer values of x from -4 to 5 and name
it as y.
(viii) A tuple of 10 random integers in the range -30 to -20 and name it as C.
(ix) A list, named A, containing 3 numbers, and a tuple, named B, congaing list A and 3
numbers.
(x) A tuple, named A, containing 3 numbers, and another tuple, named B, containing tuple A and
another unnamed tuple of 3 integers.
2. Consider the list A and tuple B given below and state the values (True/False) of the expressions that
follow:
A=[5, 3, 8], B=(A, 8, 66, 45)

(i) A in B (ii) 'A' in B (iii) [A] in B (iv) [5,3,8] in B


(v) 8 in B (vi) [8] in B (vii) [A, 8] in B (viii) 66 in B
(ix) 45 in B (x) A not in B

Answers:
(i) fruit=('banana','mango','apple','peach','grapes')
(ii) City=('Delhi','Chennai','Kannur','Jalandhar','Hyderabad')
(iii) Mixed=('banana','apple','grapes',12,13)
(iv) Box=(1,5,2,['a','b'])
(v) R10=(random.randint(10,50) for i in range(10))
(vi) F10=(random.randint(1000,4999)/100 for i in range(10))
(vii) y=(x*x+2*x-1 for x in range(-4,6))
(viii) C=(random.randint(-30,-20)
for x in range(10))
(ix) A=[3,5,6.7]
B=(A,1,2,3)
(x) A=(3,5,6.7)
B=(A,(1,2,3))

.
(i) True (ii) False (iii) False (iv) True
(v) True (vi) False (vii) False (viii)
True
(ix) True (x) False

Write the output:


tuplex = (4, 6, 2, 8, 3, 1)
print(tuplex)
#tuples are immutable, so you can not add new elements
#using merge of tuples with the + operator you can add an element and
it will create a new tuple
tuplex = tuplex + (9,)
print(tuplex)
#adding items in a specific index
tuplex = tuplex[:5] + (15, 20, 25) + tuplex[:5]
print(tuplex)
#converting the tuple to list
listx = list(tuplex)
#use different ways to add items in list
listx.append(30)
tuplex = tuple(listx)
print(tuplex)

Output:
(4, 6, 2, 8, 3, 1)
(4, 6, 2, 8, 3, 1, 9)
(4, 6, 2, 8, 3, 15, 20, 25, 4, 6, 2, 8, 3)
(4, 6, 2, 8, 3, 15, 20, 25, 4, 6, 2, 8, 3, 30)

Programs

1. Create a tuple named tuple1 with different data types.

tuple1 = ("Apple", False, 3.2, 1)


print(tuple1)

2. Create a tuple with 9 elements. Let the user enter a number. Display
how many times it is present.

tuple1 = (2, 4, 5, 6, 2, 3, 4, 4, 7 )
n=int(input("Enter number to be searched "))
print(tuple1)
#return the number of times it appears in the tuple.
count = tuple1.count(n)
print(count)

Output if 4 is input

(2, 4, 5, 6, 2, 3, 4, 4, 7 )
3
3. Modify the above program. Let the user enter 5 elements. Let the user
enter a number to be searched. Display how many times it is present in
the tuple.

L=[]
for i in range(0,5):
x=int(input("Enter a number "))
L.append(x)

tuple1=tuple(L)
print(tuple1)

n=int(input("Enter number to be searched "))


#return the number of times it appears in the tuple.
count1 = tuple1.count(n)
print("No of times Present ",count1)

Output:
Enter a number 3
Enter a number 5
Enter a number 7
Enter a number 2
Enter a number 3
Enter number to be searched 3
(3, 5, 7, 2, 3)
No of times Present 2

(Modify the program to display whether searched number is present or not.. Tip : if count1==0 )

4. Given a tuple, remove the 3rd element.

tuplex = ("w", 3, "r","c", "e")


print(tuplex)

#tuples are immutable, so we can not remove elements


#using merge of tuples with the + operator you can
remove an item and it will create a new tuple

tuplex = tuplex[:2] + tuplex[3:]


print(tuplex)

Output:
('w', 3, 'r', 'c', 'e')
('w', 3, 'c', 'e')

5. Modify the above program so that position(x) from where element is to


be deleted is entered from the keyboard. Element is deleted and new
tuple is displayed.

x= int(input("Enter position from where element is to be deleted"))


tuplex = ("w", 3, "r","c", "e")
print(tuplex)

n=x-1

#tuples are immutable, so we can not remove elements


#using merge of tuples with the + operator you can
remove an item and it will create a new tuple

tuplex = tuplex[:n] + tuplex[x:]


print(tuplex)

Output:

Enter position from where element is to be deleted 2


('w', 3, 'r', 'c', 'e')
('w', 'r', 'c', 'e')

6. Create 2 tuples with characters and integers. Reverse them and display reversed
tuples.

#create a tuple

x = ("m", "a")
# Reversed the tuple
y = reversed(x)
print(tuple(y))

#create another tuple


x = (5, 10, 15, 20)
# Reversed the tuple
y = reversed(x)
print(tuple(y))

Imp Question. Why is this error being displayed?

# Changing tuple values


my_tuple = (4, 2, 3, 6, 5)

# TypeError: 'tuple' object does not support item assignment


# my_tuple[1] = 9

You might also like