Question: Write a program that prompts the user to input a dictionary, calculates the sum of its values using a function ( this function will take

Write a program that prompts the user to input a dictionary, calculates the sum of its
values using a function (this function will take the dictionary as argument and returns the
sum of all the values in the dictionary), and prints the result.
Sample Input:
Enter the number of key-value pairs in the dictionary: 4
Enter key: a
Enter value for key a : 10
Enter key : b
Enter value for key b : 20
Enter key : c
Enter value for key c : 30
Enter key : d
Enter value for key d : 40
Sample Output:
The sum of values: 100
5. Write a python program that performs the following operations:
Create two sets, set1 containing elements 1,2,3,4,5,6 and set2 containing elements
4,5,6,7,8,9.
Write functions to get:
o Union of the two sets.
o Intersection of the two sets.
o Difference of the two sets.
o Symmetric Difference of the two sets.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!