You are on page 1of 2

Computer Science

Assignment Class 11
Tuples and Dictionaries in Python

Tuples
1. Write a program to find the product of elements of a tuple which have 7 in the
units place.

2. What do you mean by packing in a Tuple. Give an example.


3. How is a tuple different from a list.
4. Give the output of the following program segment.
X=(6,7)
Y=X*3
Z=X*(3)
print ( Y )
print ( Z )
5. Give the output of the following program segment.
X = ( 88 , 85 , 80 , 88 , 83 , 86 )
a=X[2:2]
b=X[2: ]
c=X[ :2]
d=X[ :-2]
e=X[-2: ]
f=X[2:-2]
g=X[-2:2]
h=X[ : ]
print ( a , b, c , d , e , f, g , h )
6. Explain the use of following functions with an example:
( a ) sorted ( )
( b) max ( )
( c ) index ( )
( d ) tuple ( )

Dictionaries
1. Define the term Dictionary in Python.
2. How are dictionaries different from lists ?
3. Write any 3 basic characteristics of a dictionary.
4. Give the use of the functions used for a dictionary.
( a ) keys ( )
( b) clear ( )
( c ) get ( )
( d ) items ( )
( e ) update( )
( f ) fromkeys( )
5. Write a program to find the name of the book which has maximum price
out of 5 books in the library.
6. Give difference between pop( ) and popitem( ). Give an example of both
functions.
7. Briefly explain utility of a nested dictionary in Python.

You might also like