
Tuple Questions in Python Class 11
Tuples CBSE Syllabus : 2021 – 22)
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

Q1. What do you mean by Tuple in Python?
OR
Q1. Define Tuple
Q2. Write a statement to create an empty tuple named ‘T1’.
Q3. Write a statement to create a tuple ‘T1’ containing first five even numbers.
Q4. Write the code to convert the given list L1 to tuple. L1 = [1, 2, 3, 4, 5]
Q5. Write a statement to create tuple T1 with single element.
Tuple Questions in Python Class 11
Q6. Write the output of the following code :
T1 = (4) print(type(T1))
Q7. Write the output of the following code :
T1 = 4, 5, 6 print(type(T1))
Q8. Write the output of the following code :
T1 = (1, 2, 3, 4, 5, 6, 7, 8) print(T1) print(T1 * 2) print(T1 + T1) print(len(T1) * 2)
(1, 2, 3, 4, 5, 6, 7, 8)
(1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8)
(1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8)
16
Q9. Write a statement to create tuple T1 with the following data.
1, 4, ‘CS’, ‘IP’, 5
Q10. Write the output of the following code :
T1 = (1, 2, 3, 4, 5, 6, 7, 8) print(T1[0]) print(T1[-1]) print(T1[2 + 3]) print(T1[4 - 1]) print(T1[7%2])
1
8
6
4
2
Tuple Questions in Python Class 11

Tuple Questions in Python Class 11
Q11. Write the output of the following :
T1 = (1, 2, 3, 4, 5, 6, 7, 8) print(T1[ : ]) print(T1[3 : ]) print(T1[ : 4]) print(T1[-2 : -5 ])
(1, 2, 3, 4, 5, 6, 7, 8)
(4, 5, 6, 7, 8)
(1, 2, 3, 4)
( )
Q12. Write the output of the following :
T1 = (1, 2, 3, 4, 5, 6, 7, 8) print(T1[1 : : 2]) print(T1[-1 : -5 : -2]) print(T1[: : -1]) print(T1[ : 7 : 2])
(2, 4, 6, 8)
(8, 6)
(8, 7, 6, 5, 4, 3, 2, 1)
(1, 3, 5, 7)
Q13. Which error is returned by the following code :
T1 = (1, 2, 3, 4, 5, 6, 7, 8) print(T1[15])
Q14. Write two differences between Tuple and List.
Tuple List It is immutable data type It is mutable data type Iteration is faster through Tuple Iteration is slower in List Tuples uses less memory List uses more memory. It can be used as a key in Dictionary It can not be used as a key in Dictionary
Tuple Questions in Python Class 11
Q15. Write a statement in python to concatenate the given tuples.
T1 = (1, 2, 3)
T2 = (5, 6, 7)
Q16. Write the output of the following code :
T1 = (45, 67, 98) T1 = T1 + (1, 2, 3) print(T1)
Q17. Write the output of the following code :
T1 = (45, 67, 98) T1 = T1 * 3 print(T1)
Q18. Write the output of the following code :
T1 = (45, 67, 98) T2 = ((45, 67, 98)) print(T1 in T2) print(45 in T2) print(45 in T1) print(T1 + T2)
False
True
True
(45, 67, 98, 45, 67, 98)
Q19. Explain the following functions in reference to Tuple in Python.
1. len( )
2. count( )
>>>tuple1 = (10,20,30,40,50) count( ) : This function returns the number of times the given element appears in the tuple. for example >>>tuple1 = (10, 20, 30, 10, 40, 10, 50)
>>>len(tuple1)
5
>>>tuple1.count(10)
3
Q20. Write a program to accept five numbers from the user and store it in a tuple ‘T1’.
Ans. T1 = () i =0 while(i<5): num = int(input("Enter any number : ")) T1 = T1 + (num,) i = i+1 print(T1) OUTPUT : # You can enter any other number Enter any number : 1 Enter any number : 2 Enter any number : 3 Enter any number : 4 Enter any number : 5 (1, 2, 3, 4, 5)
Tuple Questions in Python Class 11

Tuple Questions in Python Class 11
Q21. Write a program to accept five fruit name from the user and store it in a tuple ‘F1’.
Ans. F1 = () i =0 while(i<5): frnm = input("Enter any fruit name : ") F1 = F1 + (frnm,) i = i+1 print(F1) OUTPUT # You can enter any other fruit name Enter any fruit name : Apple Enter any fruit name : Mango Enter any fruit name : Banana Enter any fruit name : Grapes Enter any fruit name : Kiwi ('Apple', 'Mango', 'Banana', 'Grapes', 'Kiwi')
Q22. Write a program to store ‘n’ number of sports in a tuple ‘S1’. (Accept ‘n’ from the user)
Ans. S1 = () n = int(input("How many sports you want enter : ")) i =0 while(i<n): spnm = input("Enter sport name : ") S1 = S1 + (spnm,) i = i+1 print(S1) OUTPUT : How many sports you want enter : 3 Enter sport name : Hockey Enter sport name : Cricket Enter sport name : Football ('Hockey', 'Cricket', 'Football')
Q23. Consider the following tuple and write the code for the following statements :
T1 = (12, 3, 45, ‘Hockey’, ‘Anil’, (‘a’, ‘b’))
a. Display the first element of ‘T1’
b. Display the last element of ‘T1’
c. Display ‘T1’ in reverse order.
d. Display ‘Anil’ from tuple ‘T1’
e. Display ‘b’ from tuple ‘T1’
a. print(T1[0]) b. print(T1[-1]) c. print(T1[: : -1]) d. print(T1[4]) or print(T1[-2]) e. print(T1[-1][-1]) or print(T1[5][1])
Q24. Write the output of the following :
for i in tuple("SHIMLA"):
print(i + i)SS
HH
II
MM
LL
AA
Q25. Write the output of the following :
>>> 7 in tuple(“123456789”)
>>> ‘7’ in tuple(“123456789”)
False True
Tuple Questions in Python Class 11
Q26. Write the output of the following :
T1 = (23, 32, 4, 5, 2, 12, 23, 7, 9, 10, 23) print(len(T1) + T1[-1]) print(T1[T1.count(23) + len(T1) -5]) print(T1.count(T1[6])) print(T1.count(max(T1)))
34
10
3
1
Q27. Write the output of the following :
T1 = (23, 32, 4, 5, 2, 12, 23, 7, 9, 10, 23) print(max(T1)) print(min(T1))
Ans. 23 2
Q28. Write the output of the following :
T1 = ('Hockey', 'Cricket', 'Football')
print(max(T1))
print(min(T1))Ans. Hockey Cricket
Q29. Write the output of the following :
T1 = ('Raman', 'Ram', 'Ramaiya')
print(max(T1))
print(min(T1))Ans. Raman Ram
Q30. Write the output of the following :
T1 = (23, 32, 4, 5, 2, 12, 23, 7, 9, 10, 23) print(sorted(T1)) print(sorted(T1[2 : 7])) print(T1.index(23)) print(T1.index(23, 3, 9))
Ans. [2, 4, 5, 7, 9, 10, 12, 23, 23, 23, 32] [2, 4, 5, 12, 23] 0 6
Tuple Questions in Python Class 11
Q31. Write the output of the following :
T1 = (23, 32, 4, 5, 2, 12, 23, 7, 9, 10, 23) print(sum(max(T1) + min(T1)))
Q32. Write a program to accept three numbers from the user and insert it at the end of given Tuple T1.
T1 = (23, 32, 4, 5, 2, 12, 23, 7, 9, 10, 23)
Ans. T1 = (23, 32, 4, 5, 2, 12, 23, 7, 9, 10, 23) t=( ) for i in range(3): n1 = int(input("Enter any number : ")) t=t+(n1,) T1=T1 + t print(T1) OUTPUT : Enter any number : 26 Enter any number : 27 Enter any number : 28 (23, 32, 4, 5, 2, 12, 23, 7, 9, 10, 23, 26, 27, 28)
Q33. What type of error is returned by following statement :
>>> (a,b,c,d) = (5, 6, 8)
Q34. Write the output of the following code :
>>>(name, rollNo, subject) = ("Anil", 9, "CS")
>>> nameQ35. Which escape character is used for following :
a. for adding horizontal tab space.
b. for inserting a new line.
b. \n
Tuple Questions in Python Class 11
Q36. What do you mean by Nested Tuple? Give one example
st=((101, “Amit”, 90), (107, “Anish”, 85), (21, “Suman”, 80))
Q37. Write a statement to print 30 from the given tuple.
a = (“Seventy”, [1, 2, 3], (20, 30, 40), “Eighty”)
Q38. Write a statement to unpack the following tuple into 3 variables.
(60, 70, 80)
Q39. Write a program to swap the values of given tuples.
T1 = (“A”, “B”)
T2 = (34, 65)
Ans. T1 = ("A", "B") T2 = (34, 65) T1, T2 = T2, T1 print("T1 = ", T1) print("T2 = ", T2) OUTPUT : T1 = (34, 65) T2 = ('A', 'B')
Q40. Write the output of the following code :
T1 = ("A",["B","D"],"C")
T1[1][1] = "C"
print(T1)Tuple Questions in Python Class 11
Q41. Write a program to print the frequency of a number accepted from the user in given tuple : T1 = (12, 17, 18, 25, 19, 12, 18, 5)
Ans. T1 = (12, 17, 18, 25, 19, 12, 18, 5) n1 = int(input("Enter any number : ")) print(T1.count(n1)) OUTPUT : Enter any number : 12 2
Q42. Write a program in python to concatenate all the characters of given tuple. T1 = (‘B’ , ‘O’, ‘O’, ‘K’)
Expected OUTPUT : BOOK
Ans. T1 =('B' , 'O', 'O', 'K') st = "" for i in T1: st = st + i print(st) OR T1 =('B' , 'O', 'O', 'K') st = "".join(T1) print(st)
Q43. Write a program to remove a number (accepted from the user) from the given tuple T1 = (12, 15, 18, 21, 24, 27, 30)
SAMPLE EXECUTION Enter element to remove : 21 Tuple after removing element is : (12, 15, 18, 24, 27, 30)
Ans. T1 = (12, 15, 18, 21, 24, 27, 30) el = int(input("Enter the element to be removed : ")) if el in T1: L = list(T1) L.remove(el) T1 = tuple(L) print(T1) else: print("Element not found") OUTPUT : Enter the element to be removed : 21 (12, 15, 18, 24, 27, 30)
Q44. What do you mean by Unpacking Tuple? Give example
T1 = (2, 4, 6)
x, y, z = T1
print(x)
print(y)
print(z)
OUTPUT :
2
4
6
Q45. What do you mean by Packing Tuple? Give Example
T1 = 2, 4, 6
Tuple Questions in Python Class 11
Q46. Write one similarity between Tuples and String.
Q47. Write the output of the following :
T1 = (2, 'Apple', 6) print(max(T1))
Q48. Consider the given tuple and write the output of given statements: T1 = (1, 23, 4, 5, “A”, [“C”, “D”], (23, 45), 45)
- print(len(T1))
- print(T1.index(45))
- print(T1.count(45))
- print(T1[5][0]*2)
- print(T1[:5])
- print(T1[5:])
- print(T1.index(“A”))
- print(T1[-1 : -7 : -2])
- print(T1[4] + T1[5])
- print(max(T1))
Ans. 1. 8 2. 7 3. 1 4. CC 5. (1, 23, 4, 5, 'A') 6. (['C', 'D'], (23, 45), 45) 7. 4 8. (45, ['C', 'D'], 5) 9. Error 10. Error
Q49. Write the length of following tuple :
T1 = (1,(2,3),(((34,56),45,67),39))
Q50. Write a program to store the detail ( Roll number, Name, Section) of three students in a tuple. Accept all data from the user.
SAMPLE OUTPUT : ((1, 'Amita', 'B'), (2, 'Sunita', 'C'), (3, 'Daya', 'A'))
Ans. Det = () tmp=() for i in range(3): rn = int(input("Enter Roll number : ")) nm = input("Enter name of student : ") sec = input("Enter Section of student : ") tmp = (rn, nm, sec) Det=Det + (tmp,) print(Det) Enter Roll number : 1 Enter name of student : Amita Enter Section of student : B Enter Roll number : 2 Enter name of student : Sunita Enter Section of student : C Enter Roll number : 3 Enter name of student : Daya Enter Section of student : A ((1, 'Amita', 'B'), (2, 'Sunita', 'C'), (3, 'Daya', 'A'))
Tuple Questions in Python Class 11
Q51. Write a program to accept roll number from user and display it’s detail from given tuple
Det=((1, ‘Amita’, ‘B’), (2, ‘Sunita’, ‘C’), (3, ‘Daya’, ‘A’))
Ans. Det=((1, 'Amita', 'B'), (2, 'Sunita', 'C'), (3, 'Daya', 'A')) rn = int(input("Enter Roll number : ")) k=0 for i in range(3): if rn==Det[i][0]: print(Det[i]) k=1 break if k==0: print("Record not found") OUTPUT : Enter Roll number : 2 (2, 'Sunita', 'C') Enter Roll number : 8 Record not found
Q52. Write a program to accept five numbers from the user and store these numbers in a tuple. Display the following from tuple :
- Largest number
- Smallest number
- Sum of all numbers
- Average of all numbers
Ans. t = () for i in range(5): n1 = int(input("Enter any number : ")) t = t + (n1,) print("Largest Number is : ", max(t)) print("Smallest Number is : ", min(t)) print("Sum of all Numbers is : ", sum(t)) print("Average is : ", sum(t)/5) OUTPUT : Enter any number : 1 Enter any number : 2 Enter any number : 3 Enter any number : 4 Enter any number : 5 Largest Number is : 5 Smallest Number is : 1 Sum of all Numbers is : 15 Average is : 3.0
Q53. Write a program in python to print the second largest element in tuple given below :
T1 = (23, 45, 87, 45, 67, 43, 23, 12)
Ans. T1 = (23, 45, 87, 45, 85, 43, 23, 12) T1=sorted(T1) print(T1[-2])
Q54. Write a program in python to display the sum of all even numbers and odd numbers separately from the tuple given below :
T1 = (24, 45, 87, 46, 67, 44, 23, 12)
Ans. T1 = (24, 45, 87, 46, 67, 44, 23, 12) se=0 so=0 for i in T1: if i%2==0: se = se + i else: so = so + i print("Sum of even numbers are : ", se) print("Sum of odd numbers are : ", so)
Q55. Write the output of the following :
T1 = (“Amit”, “Sumit”)
T2 = “Sumit”, “Amit”
T3 = “Amit”, “Sumit”
print(T1==T2)
print(T1==T3)
Ans. False True
Tuple Questions in Python Class 11
Q56. Write a program to accept a number from the user and store first 10 multiples of number in a tuple for example :
SAMPLE OUTPUT : Enter any number : 4 Tuple = (4, 8, 12, 16, 20, 24, 28, 32, 36, 40)
Ans. n1 = int(input("Enter any number : ")) t = ( ) for i in range(1,11): t = t + (n1*i,) print("Tuple = ",t)
Q57. Write a program to accept a string from the user and convert it into tuple. for example
SAMPLE OUTPUT :
Enter any String : tuple
Tuple = ('t', 'u', 'p', 'l', 'e')Ans. str = input("Enter any String : ") T1 = tuple(str) print(T1)
Q58. Write a program to display the sum of all the numbers in a given tuple :
T1 = (1, 2, 3, ‘A’, ‘B’, 4, ‘Sun’)
Ans. T1 = (1, 2, 3, 'A', 'B', 4, 'Sun') s = 0 for i in T1: if str(i).isdigit( ): s = s + i print("Sum is = ",s) OUTPUT : Sum is = 10
Q59. Write a program to find the sum of marks of all students stored in the given tuple.
T1 = ((“Suman”, 75),(“Glory” , 35),(“Ravi”,50))
Expected Output is : 160
Ans. T1 = (("Suman",75), ("Glory" , 35), ("Ravi",50)) s = 0 for i in T1: s = s + i[1] print("Sum of marks = ",s)
Q60. Write the output of the following :
T1 = (1, (2, 'a'), (3, 'b', 'c'), (7, 'd', 'e', 'f')) print(len(T1)) print(T1[1][0]) print(7 in T1[3]) print(T1.index(1)) print(len(T1[3])) print(T1[T1[2][0]])
Ans. 4 2 True 0 4 (7, 'd', 'e', 'f')
Tuple Questions in Python Class 11
Q61. Write the output of the following :
T1 = (1,(2, 'a', (3, 'b', 'c', (7, 'd', 'e', 'f')))) print(len(T1)) print(T1[1][0]) print(7 in T1[1]) print(T1.index(1)) print(len(T1[1])) print(T1[T1[0]])
Ans. 2 2 False 0 3 (2, 'a', (3, 'b', 'c', (7, 'd', 'e', 'f')))
Q62. Write the output of the following :
T1 = (1, (2, 'a') * 2) print(T1) print(len(T1)) print(T1[1][1]) print(len(T1[1]))
Ans. (1, (2, 'a', 2, 'a')) 2 a 4
Q63. Write the output of the following :
T1 = (1, (2, 'a')) * 2 print(T1) print(len(T1)) print(T1[1][1]) print(len(T1[1])) print(T1.count(1)) print(T1.index(1))
Ans. (1, (2, 'a'), 1, (2, 'a')) 4 a 2 2 0
Q64. Write the output of the following :
T1 = ('a') * 3
T2 = ('a',) * 3
print(T1)
print(type(T1))
print(len(T1))
print(T2)
print(type(T2))
print(len(T2))Ans. aaa <class 'str'> 3 ('a', 'a', 'a') <class 'tuple'> 3
Q65. Write the output of the following :
T1 = "tuple questions in python" T2 = (T1.split()) print(T1) print(type(T1)) print(len(T1)) print(T2) print(T2[0][0] + T2[1][0]) print(len(T2))
Ans. tuple questions in python <class 'str'> 25 ['tuple', 'questions', 'in', 'python'] tq 4
Tuple Questions in Python Class 11
Q66. What type of error is returned by following code :
T1 = (1, 2, 3, 4) T2 = (4, 5, 6) print(T1 - T2)
Q67. Write the output of the following :
T1 = (1, 2, 3, 4) print(T1 * 3) print(T1 * (3)) print((T1) * 3) print(T1 + (3,))
Ans. (1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4) (1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4) (1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4) (1, 2, 3, 4, 3)
Q68. Write the output of the following :
T1 = (10, 20, 30) print((T1, T1, T1)) print(T1, T1, T1) print((T1 + T1 + T1)) print(T1 * 3)
Ans. ((10, 20, 30), (10, 20, 30), (10, 20, 30)) (10, 20, 30) (10, 20, 30) (10, 20, 30) (10, 20, 30, 10, 20, 30, 10, 20, 30) (10, 20, 30, 10, 20, 30, 10, 20, 30)
Q69. Write the output of the following :
a = 30 b = (30) c = (30,) print(type(a)) print(type(b)) print(type(c))
Ans. <class 'int'> <class 'int'> <class 'tuple'>
Q70. Write a program to accept a number from the user and create a tuple containing all factors of number. for example :
SAMPLE OUTPUT : Enter any Number : 9 Tuple is : (1, 3, 9)
Ans. n1 = int(input("Enter any Number : ")) t = ( ) for i in range(1,n1+1): if n1%i == 0: t = t + (i,) print("Tuple is : ",t)
Tuple Questions in Python Class 11
Q71. Write a program to arrange all the sub tuples of a tuple in increasing order and store them in another tuple. for example
T1 = ((1, 2, 3), (45, 23), (98, 34, 67)) #Original Tuple
T2 = ((1, 2, 3), (23, 45), (34, 67, 98)) #New Tuple
Ans. T1 = ((1, 2, 3),(45, 23), (98, 34, 67)) T2 = () for i in T1: T2 = T2 + (tuple(sorted(i)),) print(T2)
Q72. Write a program to store the length of all sub tuples of a tuple into a new tuple. for example
T1 = ((1, 2, 3), (45, 23), (98, 34, 67),(34, 56, 78, 9)) #Original Tuple
T2 = (3, 2, 3, 4) # New Tuple
Ans. T1 = ((1, 2, 3), (45, 23), (98, 34, 67),(34, 56, 78, 9)) T2 = () for i in T1: T2 = T2 + (len(i),) print(T2)
Q73. Write a program to print square of all odd numbers of a tuple.
T1 = (12, 13, 22, 7, 9, 66, 4)
Expected Output : 169, 49, 81
Ans. T1 = (12, 13, 22, 7, 9, 66, 4) for i in T1: if i%2 != 0: print(i * i, end= " ")
Q74. Write a program to print the common elements of given tuples :
T1 = (1, 2, 3, 4, 5, 6)
T2 = (3, 5, 7, 9, 11)
Expected Output : 3, 5
Ans. T1 = (1, 2, 3, 4, 5, 6) T2 = (3, 5, 7, 9, 11) for i in T1 : if i in T2: print(i, end = "")
Q75. Write a program to find the union (Common element include once) of given tuples:
T1 = (1, 2, 3, 4, 5, 6)
T2 = (3, 5, 7, 9, 11)
Expected Output : 1, 2, 3, 4, 5, 6, 7, 9, 11
Ans. T1 = (1, 2, 3, 4, 5, 6) T2 = (3, 5, 7, 9, 11) T3 = T1 for i in T2 : if i not in T1: T1 = T1 + (i,) print(T1)
Tuple Questions in Python Class 11
Q76. Write a program to store the sum of all sub tuples of given tuple into a new tuple. for example
T1 = ((1, 2, 3), (45, 23), (98, 34, 67),(34, 56, 78, 9)) #Original Tuple
T2 = (6, 68, 199, 177) # New Tuple
Ans. T1 = ((1, 2, 3), (45, 23), (98, 34, 67),(34, 56, 78, 9)) T2 = ( ) for i in T1: T2 = T2 + (sum ( i ), ) print(T2)
Q77. Write a program to store the maximum value of all sub tuples of given tuple into a new tuple. for example
T1 = ((1, 2, 3), (45, 23), (98, 34, 67),(34, 56, 78, 9),(“A”, “B”, “c”))
#Original Tuple
T2 = (3, 45, 98, 78, c) # New Tuple
Ans. T1 = ((1, 2, 3), (45, 23), (98, 34, 67), (34, 56, 78, 9), ("A", "B", "c")) T2 = () for i in T1: T2 = T2 + (max (i),) print(T2)
Q78. Write a program to display the longest sub tuple from the given tuple.
T1 = ((1, 2, 3), (45, 23), (98, 34, 67), (34, 56, 78, 9)) #
Original Tuple
T2 = (34, 56, 78, 9) # New Tuple
Ans. T1 = ((1, 2, 3), (45, 23), (98, 34, 67),(34, 56, 78, 9),("A", "B", "c")) T2 = () for i in T1: T2 = T2 + (len (i),) ind = T2.index(max(T2)) print(T1[ind])
Q79. Write a program to display names starting from vowel from the given tuple.
T1 = (“Amit”, “Ram”, “Esha”, “Harry”)
Ans. T1 = ("Amit", "Ram", "Esha", "Harry") for i in T1: if i[0] in ("aeiouAEIOU"): print(i) OUTPUT : Amit Esha
Q80. Write a program to print the length of all names in a given tuple.
T1 = (“Amit”, “Ram”, “Esha”, “Harry”)
Expected Output : 4, 3, 4, 5
Ans T1 = ("Amit", "Ram", "Esha", "Harry") for i in T1: print(len(i),end=", ")
Tuple Questions in Python Class 11
Q81. What is the purpose of following operators in reference to tuples.
a) +
b) *
c) in
Ans. a) This (+) operator simply concatenates/joins two tuples. for example >>> (1, 2, 3) + (5, 6, 7, 8) >>> (1, 2, 3, 5, 6, 7, 8) b) This (*) operator repeats the elements in a tuple. for example >>> (1, 2, 3) * 3 >>> (1, 2,3, 1, 2, 3, 1, 2, 3) c) This (in) operator checks whether an element/value exist in tuple. for example >>>1 in (1, 2, 3) >>>True
Q82. Match the following :
| Functions | Description |
| max( ) | Returns the length of the tuple. |
| min( ) | Returns the index value of element in tuple. |
| count( ) | Returns the largest element in tuple. |
| index( ) | Returns the smallest element in tuple. |
| len( ) | Returns the frequency of an element in tuple. |
Functions Description max( ) Returns the largest element in tuple. min( ) Returns the smallest element in tuple. count( ) Returns the frequency of an element in tuple. index( ) Returns the index value of element in tuple. len( ) Returns the length of the tuple.
Q83. Write the output of the following :
>>> S = 1, (2,3,4,5), 51, (61,71)
>>> len(S)
>>>S[2 : 3]
>>>S[-1][0]
>>>type(S)
Ans. 4 51 61 <class 'tuple'
Q84. Fill in the blanks in the following code :
import ___________
t = (20, 30, 40, 50, 60, 70)
A = random.randint(1, 3)
B = random.randint(2, 4)
for i _________ range(A, B):
print (t[i],end= "@")Ans. import random t = (20, 30, 40, 50, 60, 70) A = random.randint(1,3) B = random.randint(2,4) for i in range(A,B): print (t[i],end= "@")
Tuple Questions in Python Class 11
Disclaimer : I tried to give you the correct answers of ” Tuple Questions in Python” , but if you feel that there is/are mistakes in “Tuple Questions in Python ” given above, you can directly contact me at csiplearninghub@gmail.com.
Tuple Questions in Python Class 11
Important Links
100 Practice Questions on Python Fundamentals
120+ MySQL Practice Questions
90+ Practice Questions on List
50+ Output based Practice Questions
100 Practice Questions on String
70 Practice Questions on Loops
120 Practice Questions of Computer Network in Python
70 Practice Questions on if-else
40 Practice Questions on Data Structure
Tuple Questions in Python Class 11
Class 12 Computer Science Sample Paper 2020-2021.
Class 12 Computer Science Sample Paper Marking Scheme
Class 12 Computer Science Chapter wise MCQ