Dictionary I Es
Dictionary I Es
Chapter 9 syllabus
2023-
Dictionar 24
y
Informatics Practices
Class XI ( As per CBSE
Board)
Dictionary
Output
('before del', {'Class': 11, 'Subject': 'Informatics Practices'})
('after item delete', {'Subject': 'Informatics Practices'})
('after dictionary delete', <type 'dict'>)
Dictionary
pop() method is used to remove a particular item in a
dictionary. clear() method used to remove all
is elements from the
dictionary.
e.g.
dict = {'Subject': 'Informatics Practices', 'Class': 11}
print('before del', dict)
dict.pop('Class')
print('after item
delete', dict)
dict.clear()
Output
print('after clear', dict)
('before del', {'Class': 11, 'Subject': 'Informatics Practices'})
('after item delete', {'Subject': 'Informatics Practices'})
('after clear', {})
Dictionary
Built-in Dictionary Functions
Questions.
1. Create dictionary to store 4 student details with
rollno,name,age field.Search student in list.
2. Create dictionary for month and noofdays for a
year. User is asked to enter month name and
system will show no of days of that month.