Page 533 - Computer Science V2.0 Class 11
P. 533
20. Write a program that defines a tuple of n strings. Thereafter, a new tuple is created that has each element as
(string, length of string). For example, given that
tple = ('Rise', 'and', 'Shine', 'Always')
the new tuple should be
(('Rise',4),('and',3),('Shine',5),('Always',6))
21. Write a program that accepts the names and hobbies of 10 persons and stores this information in the form of a
dictionary. The program should enumerate distinct hobbies.
22. Write a program in Python that accepts the names of the states and the number of districts in the states. The
data is stored in a dictionary. Thereafter, the user is asked to enter a state and the number of districts in that state
are displayed. Appropriate message is displayed if the name of the state does not exist in the dictionary. Create
separate user defined functions to accept data and searching for states.
Practical 519

