Changes

Jump to: navigation, search

OPS435 Python Lab 4

10 bytes removed, 21:55, 11 February 2018
Create a Python Script Demonstrating Comparing Sets
=== Create a Python Script Demonstrating Comparing Sets ===
:'''Perform the Following Instructions'''
::#Create the '''~/ops435/lab4/lab4a.py''' script. 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:<source lang="python">
#!/usr/bin/env python3
</source>
:::*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 samples:::*The script should contain no errors
::::'''Sample Run 1:'''<source>
./lab4a.py
set1: {1, 2, 3, 4, 5, 6, 7, 8, 9}
diff: {1, 2, 3, 4, 10, 11, 12, 13, 14}
</source>
::::'''Sample Run 2 (with import):'''<source>
import lab4a
set1 = {1,2,3,4,5}
# Will output {-2, -1, 0, 3, 4, 5}
</source>
<ol><li value='3' style="margin-left:40px25px;">Download the checking script and check your work. Enter the following commands from the bash shell:<source lang="bash">
cd ~/ops435/lab4/
pwd #confirm that you are in the right directory
python3 ./CheckLab4.py -f -v lab4a
</source></li>
<li style="margin-left:40px25px;">Before proceeding, make certain that you identify all errors in lab4a.py. When the checking script tells you everything is OK - proceed to the next step.</li></ol>
=== Create a Python Script Demonstrating Comparing Lists ===

Navigation menu