Page 439 - Computer Science V2.0 Class 11
P. 439
2. Assertion(A): Dictionary is a mutable data type.
Reasoning(R): The keys in a dictionary are required to be unique.
Ans. 1. d 2. b
Case-based Questions
On the occasion of an interschool festival, Ruhaan has been assigned the task of maintaining the points tally. As he just
learnt about dictionaries, he wants to develop a program that will accept from a user the following data about the events
in which a school participates:
School Name - string
Event Name- string
Position - integer
A school can participate in any one of the following events: Quiz, Hackathon, Gaming, Coding, and Image Editing. The points
will be assigned according to the position as given below:
Position Value Points
1 10
2 5
3 3
Further, he would like to store and display the resulting data in the form of a dictionary:
School Name - string
Event Name- string
Points - integer
Help Ruhan develop a menu driven program.
Ans. events = ('Quiz', 'Hackathon', 'Gaming', 'Coding', 'Image Editing')
pointsTally = {}
def menu():
'''
Objective: To display menu
Input Parameters: None
Return Value: None
'''
print("MAIN MENU")
print("1. Accept Data")
print("2. Display Data")
print("3. Display Points")
print("4. Exit")
choice = int(input("Enter your choice: "))
if choice == 1:
accept()
elif choice == 2:
display()
elif choice == 3:
Dictionaries 425

