0% found this document useful (0 votes)
48 views2 pages

Dictionary Practice Paper

This document contains 18 questions about working with dictionaries in Python. The questions cover a range of tasks like sorting dictionaries, merging dictionaries, checking if a key exists, accepting user input to create dictionaries, adding/removing keys and values, and counting/modifying elements. Many questions involve storing and retrieving data from dictionaries to model real-world problems like storing employee data or student exam scores.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
48 views2 pages

Dictionary Practice Paper

This document contains 18 questions about working with dictionaries in Python. The questions cover a range of tasks like sorting dictionaries, merging dictionaries, checking if a key exists, accepting user input to create dictionaries, adding/removing keys and values, and counting/modifying elements. Many questions involve storing and retrieving data from dictionaries to model real-world problems like storing employee data or student exam scores.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 2

Informatics Practices

Class 11
Dictionary (Revision Worksheet)
Name:_______________ Date:________
Q1. Write a Python program to arrange the values in a dictionary in ascending order.
For example
Original Dictionary = {1 : 25, 2 : 21, 3 : 23}
Expected Output = [21, 25, 32]

Q2. Write a python programs to join/merge/concatenate the following two dictionaries


and create the new dictionary.
d1 = {1: “Amit”, 2 : “Suman”}
d2 = {4 : “Ravi”, 5 : “Kamal”}
New dictionary = {1: “Amit”, 2 : “Suman”, 4 : “Ravi”, 5 : “Kamal”}

Q3. Write a function check(key) which takes a key as an argument and check whether
that key is present in dictionary or not.

Q4.Accept the number of terms say n from the user and display the dictionary in the
form of {n: n*5} for example:
If number of terms entered by user is 4 then the expected dictionary is {1:5, 2:10, 3:
15, 4: 20}

Q5. Write a program to add the values of given dictionary.


d1 = {1:2, 2: 90, 3: 50}

Q6. Write a program to add the keys of given dictionary.


d1 = {1:2, 2: 90, 3: 50}

Q7. Write a program to multiply all the values of given dictionary.


d1 = {1:2, 2: 90, 3: 50}

Q8. Write a program to accept a key from the user and remove that key from the
dictionary if present.

Q9. Write a program in python to display the maximum and minimum value in
dictionary.

Q10. Write a program in python to remove the duplicate values from the dictionary.
For example:
Original dictionary = {1 : “Aman”, 2: “Suman”, 3: “Aman”}
New dictionary = {1 : “Aman”, 2: “Suman”}
Q11. Write a program to count the number of elements in a dictionary.

Q12. Accept a key from the user and modify it’s value.

Q13. Write a program to store information of products like product id, product name,
and product price in a dictionary by taking product id as a key.

Q14. Write a program to accept the employee id from the user and display its detail
from the dictionary. Data is stored in the dictionary in the following format
{Empid : (Empname, EmpSalary}

Q14. Write a program to accept the employee id from the user and check Salary. If
salary is less than 25000 then increase the salary by Rs1000. Data is stored in the
dictionary in the following format
{Empid : (Empname, EmpSalary}

Q15. Write a program to display the name of all the employees whose salary is more
than 25000 from the following dictionary.

Q16. Write a program to count the frequency of each word in a given string accepted
from the user using dictionary.

Q17. Write a program to accept roll number, names and marks of five students and
store the detail in dictionary using roll number as key. Also display the sum of marks
of all the five students.

Q18. Write a program to count the frequency of each character in a given string
accepted from the user using dictionary.(Store the character as key and it’s frequency
as value)

***************************

You might also like