Page 223 - Robotics and AI class 10
P. 223
Program 12: To use tuple method count and index.
Converting list to tuple and vice-versa
On running the above program, you will get the following output:
Program 13: A tuple “tup” stores (2,5,7,8,2,1) by mistake its last element is typed wrong. Write a program
to correct its last element as 11.
On running the above program, you will get the following output:
Converting List to Tuple and Vice-versa
A list can be converted into a tuple by using a built-in function tuple().
For example:
>>> L=[1,2,3,4]
>>> type(L)
<class 'list'>
Introduction to Data and Programming with Python 221

