0% found this document useful (0 votes)
8 views4 pages

8870184-Class XI-IP WS6

This worksheet for Class XI in Informatics Practices focuses on the concept of dictionaries in programming. It includes various exercises and coding tasks related to dictionary operations such as adding, updating, deleting items, and retrieving values. Additionally, it contains programming assignments for creating dictionaries based on user input for products, airlines, and employee salaries.

Uploaded by

angela arunraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views4 pages

8870184-Class XI-IP WS6

This worksheet for Class XI in Informatics Practices focuses on the concept of dictionaries in programming. It includes various exercises and coding tasks related to dictionary operations such as adding, updating, deleting items, and retrieving values. Additionally, it contains programming assignments for creating dictionaries based on user input for products, airlines, and employee salaries.

Uploaded by

angela arunraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

INDIAN SCHOOL AL WADI AL KABIR

Worksheet, 2024-25
Class: XI SUB: INFORMATICS PRACTICES Date of Completion:

Worksheet : 6 TOPIC: Dictionary 24-10-2024

Section A
Answer the following:

1. What is dictionary? Give a real time example.


2. Name any 6 characters of a dictionary.
3. Answer the following based on the dictionary
Shop={‘soap’:25,’watch’:350,’perfume’:500,’paste’:120,’shampoo’:300}
a. Find out the number items in this dictionary
b. Display the price of perfume
c. Change the price of watch to 400
d. Display the list of keys and values separately
e. Show all the items present
f. Add a new item as shirt:900
g. Find out paste in the shop if found display it’s price otherwise display ‘no found’
h. Search for paste in the dictionary
i. Delete the details of shirt from shop
j. How do you clear the contents only from shop
k. Remove the dictionary from the memory.

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. Give the output for the following.


d1={10:'hello',12:"dear",9:"friend",15:"study",7:"in", 11:"class"}

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.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy