Question: Lab4a.py Create the ~/ops445/lab4/lab4a.py script. The purpose of this script will be to demonstrate the different way of comparing sets. There will be three functions,

Lab4a.py


  1. Create the~/ops445/lab4/lab4a.pyscript. The purpose of this script will be to demonstrate the different way of comparing sets. There will be three functions, each returning a different set comparison.
  2. Use the following template to get started:


#!/usr/bin/env python3 def join_sets (s1, s2): # join_sets will return a set
  • The join_sets() function should return a set that contains all values from both sets
  • The match_sets() function should return a set that contains all values found in both sets
  • The diff_sets() function should return a set that contains all values which are not shared between both sets
  • All three functions should accept two arguments both are sets
  • The script should show the exact output as the sample below
  • that contains every value from both s1 and s2 def match_sets (s1,  

#!/usr/bin/env python3 def join_sets (s1, s2): # join_sets will return a set that contains every value from both s1 and s2 def match_sets (s1, s2): # match_sets will return a set that contains all values found in both s1 and s2 def diff_sets (s1, s2): # diff_sets will return a set that contains all different values which are not shared between the sets if name '__main__': set1 = set (range (1,10)) set (range (5,15)) set2 = print('set1: ', set1) print ('set2: ', set2) print('join: ', join_sets (set1, set2)) print( 'match: ', match_sets (seti, set2)) print('diff: ', diff_sets(set1, set2)) ==

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Certainly Below is the implementation of the joinsets matchsets and diffsets functions as ... View full answer

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!