Question: Problem 5 : Set Operations - Union Given two sets = { 1 , 2 , 3 } and = { 3 , 4 ,

Problem 5: Set Operations - Union
Given two sets ={1,2,3} and ={3,4,5}, find the union of these two sets and print the result.
Problem 6: Set Operations - Intersection
For the following sets 'set_x`={10,20,30,40} and 'set_y'={30,40,50,60}, determine the intersection and print the shared elements.
Problem 7: Dictionary Manipulations
Create a dictionary named 'fruit_prices` with the following fruit names as keys and their corresponding prices as values:
Apple: 0.65
Banana: 0.35
Cherry: 2.50
Then, update the price of the cherry to 2.75 and add another entry for grapes with a price of 1.85.
Problem 8: Set Operations
Create two sets, 'set_one' with numbers {1,2,3,4,5} and 'set_two' with numbers {4,5,6,7,8}. Find the union and intersection of these two sets.
Problem 9: Adding to a Dictionary
Given a dictionary with student names as keys and their grades as values:
student_grades ={"Alice": 88, "Bob": 76, "Charlie": 90}
Add a new student "Diana" with a grade of 95 and then retrieve the grade for "Alice".
Problem 10: Removing from a Dictionary
Create a dictionary for a small office where the keys are employee names and the values are their phone extension numbers. Include at least three employees. Then, remove one employee from the dictionary and add a new employee with a different extension.
Problem 11: Dictionary Manipulations
Given a set 's1' with elements '{10,20,30,40,50}', perform the following tasks:
Remove element 20 from 's1.
Add a new element 60 to 's1'.
Problem 12: Dictionary Manipulations
Construct a dictionary 'inventory' where the keys are item names and the values are quantities. Start with 'Pens' with a quantity of 24 and 'Notebooks' with a quantity of 48. Then update 'Pens' to 30 and add 'Markers' with a quantity of 15.
Problem 13: Determining Set Differences
Create a set 'prime_numbers' with the-first five prime numbers. Then, create another set 'fibonacci_numbers' with the first five numbers in the Fibonacci sequence. Find the symmetric difference between the two sets. Note: you need to look up these series to determine what to put in the sets.
Problem 14: Finding Differences Between Sets
Create two sets, 'even_numbers' with numbers {2,4,6,8,10} and 'odd_numbers' with numbers {1,3,5,7,9}. Find the difference between 'even_numbers`' and 'odd_numbers'.
Problem 15: Working with Dictionaries
Create a dictionary 'reverse_lookup' where you will store numbers as keys and their word forms as values (e.g.,1:'One'). Start with numbers 1 to 5. Then, add another entry for the number 6 and its word form. Access the word form of number 3.
Problem 5 : Set Operations - Union Given 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!