Answered step by step
Verified Expert Solution
Link Copied!

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


  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:


image
  • 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
  • image  

#!/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 ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intermediate Microeconomics

Authors: Hal R. Varian

9th edition

978-0393123975, 393123979, 393123960, 978-0393919677, 393919676, 978-0393123968

More Books

Students also viewed these Programming questions

Question

3. Housekeeping, such as watering plants or storing personal items

Answered: 1 week ago