8870184-Class XI-IP WS6
8870184-Class XI-IP WS6
Worksheet, 2024-25
Class: XI SUB: INFORMATICS PRACTICES Date of Completion:
Section A
Answer the following:
Section B
1. Find the output of the following codes:
(a)
D1 = {1 : 10, 2 : 20, 3 : 30, 4 : 40, 5 : 50}
print(D1.keys())
print(D1.values())
print(D1.items())
(b)
D1 = {1 : 10, 2 : 20, 3 : 30, 4 : 40}
D2 = {5 : 50, 6 : 60, 7 : 70}
1| 1 8 - 1 0 - 2 0 2 4 / P R E P A R E D B Y : M r s . A N I L A B & M r . J A G D E E S H P A T I L |
ICT Dept.
print(D1.update(D2))
print(D1)
(c)
D3 = {1 : 100, 2 : 150, 3 : 200}
D4 = {4 : 250, 2 : 175, 5 : 400, 3 : 225}
print(D3.update(D4))
print(D3)
(d)
Comp = { 'Dell' : 25000, 'HP' : 28500, 'Lenovo' : 23250 }
NewComp = { 'Acer' : 17300, 'Lenovo' : 24500, 'Apple' : 37400 }
Comp.update(NewComp)
print(Comp)
(e)
TV = { 'Ikon' : 22000 ,'Samsung' : 29300, 'LG' : 27800, 'Sony' : 38000, 'Philips' : 24000}
print(TV.keys())
print(TV.values())
del TV['Sony']
print(TV)
TV.pop('LG')
print(TV)
print(TV.clear())
print(TV)
(f)
TV = { 'Ikon': 22000 ,'Samsung' : 29300, 'LG' : 27800, 'Sony' : 38000, 'Philips' : 24000 }
print('Sony' in TV)
print('TCL' in TV)
print('Philips' not in TV)
print('SAMSUNG' not in TV)
(g)
Comp = { 'Dell' : 25000, 'HP' : 28500, 'Lenovo' : 23250, 'Acer' : 17300, 'Apple' : 37400}
print(len(Comp))
del(Comp['Acer'])
print(Comp)
Comp['Asus'] = 29500
Comp.pop('HP')
print(len(Comp))
2| 1 8 - 1 0 - 2 0 2 4 / P R E P A R E D B Y : M r s . A N I L A B & M r . J A G D E E S H P A T I L |
ICT Dept.
a) print(d1.values())
b) print(list(d1.values())
c) print(d1[9])
d) print(d1[10]+d1[9])
e) 15 in d1
f) ”study” in d1
g) d1.get(25,”not found”)
h) for i in d1:
if d1[i]==”friend”:
print(i)
i) del d1[12]
print(d1)
j) d1.pop(7)
print(d1)
3. Guess the output.
fur={'chair':35,'table':250,'lamp':65,'stand':23,'sofa':350}
a. print(max(fur))
b. print(min(fur))
c. L=list(fur.values())
print(max(L))
d. for i in fur:
print(i)
e. for i in fur:
print(fur[i])
f. print(fur['table']+fur['stand'])
g. for i in fur:
if i=='chair':
print(fur[i]+10)
h. for i in fur:
if i=='stand':
print(i+'sofa')
i. x=list(fur.items())
3| 1 8 - 1 0 - 2 0 2 4 / P R E P A R E D B Y : M r s . A N I L A B & M r . J A G D E E S H P A T I L |
ICT Dept.
print(x[2])
j. print(fur.popitem())
k. fur.update({'table':275,'bed':500})
print(fur)
l. fur['lamp']=70
print(fur)
4. Answer the following based the dictionary d1 given
d1={'a':10,'c':30,'e':50 ,'b':20,'d':40}
a. Display the keys of the dictionary in ascending order.
b. Find the maximum value among the keys.
c. Find the minimum value among the values.
d. Find out the sum of values of keys ‘a’ and ‘e’.
e. Find the sum of all the values.
Section C
1) Write a program that repeatedly asks the user to enter product names and prices. Store all of
them in a dictionary whose keys are product names and values are prices. And also write a
code to search an item from the dictionary.
2) Write a program that repeatedly asks the user to enter airline names and airfare. Store all of
them in a dictionary whose keys airline names and values are airfare. And also write a code to
calculate and display the average airfare of all airlines.
3) Write a program that repeatedly asks the user to enter employee names and salaries. Store all
of them in a dictionary whose keys are employee names and values are salaries. And also
write a code to count the number of employees getting salary more than 5000.
4| 1 8 - 1 0 - 2 0 2 4 / P R E P A R E D B Y : M r s . A N I L A B & M r . J A G D E E S H P A T I L |
ICT Dept.