Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
- 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.
- Use the following template to get started:
- 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
#!/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
Step: 1
Certainly Below is the implementation of the joinsets matchsets and diffsets functions as ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started