Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 4

4 bytes removed, 23:21, 16 August 2017
Create a Python Script Demonstrating Comparing Lists
:'''Perform the Following Instructions'''
::#Create the '''~/ops435/lab4/lab4b.py''' script. The purpose of this script will be to improve the previous script to perform the same joins, matches, and diffs, but this time on lists.
::#Use the following as a template:<sourcelang="python">
#!/usr/bin/env python3
def join_lists(list1l1, list2l2): # join_lists will return a list that contains every value from both list1 l1 and list2 l2 inside it
def match_lists(list1l1, list2l2): # match_lists will return a list that contains all values found in both list1 l1 and list2l2
def diff_lists(list1l1, list2l2):
# diff_lists will return a list that contains all different values, which are not shared between the lists
[1, 2, 3, 4, 10, 11, 12, 13, 14]
</source>
:::3. Exit the ipython3 shell, download the checking script and check your work. Enter the following commands from the bash shell.<sourcelang="bash">
cd ~/ops435/lab4/
pwd #confirm that you are in the right directory