Changes

Jump to: navigation, search

OPS435 Python Lab 4

97 bytes added, 16:39, 5 June 2019
Create a Python Script Demonstrating Comparing Lists
=== PYTHON REFERENCE ===
:As you develop your Python scripting skills, you may start to be "overwhelmed" with the volume of information that you have absorbed over these labs. One way to help, is to learn to use online references effectively in order to obtain information regarding Python scripting techniques and tools.
:Below is a table with links to useful online Python reference sites (by category). You may find these references useful when performing assignments, etc.
list2: [5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
join: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
match: [8, 9, 5, 6, 7, 8, 9]
diff: [1, 2, 3, 4, 10, 11, 12, 13, 14]
</source>
:::'''Sample Run 2 (with import)under interactive python shell:'''<source>
import lab4b
list1 = [1,2,3,4,5]
list2 = [2,1,0,-1,-2]
print(lab4b.join_lists(list1,list2)))
# Will output [0, 1, 2, 3, 4, 5, -2, -1]
print(lab4b.match_lists(list1,list2))
# Will output [1, 2]
print(lab4b.diff_lists(list1,list2))
# Will output [0, 3, 4, 5, -2, -1]
</source>
for key in list_of_keys:
print(key)
for value in dict_york.values():
print(value)
</source>
list_values = ['70 The Pond Rd', 'Toronto', 'Canada', 'M3J3M6', 'ON']
york = lab4c.create_dictionary(list_keys, list_values)
print(york)
'Province': 'ON'}
common = lab4c.shared_values(dict_york, dict_newnham)
print(common)
course_name = 'Open System Automation'
course_code = 'OPS435'
course_number = '435'
</source>Strings can contain any '''characters''' inside them, whether they are '''letters''', '''numbers''', or '''symbols'''.
:#Strings can also be '''concatenated''' (i.e. "combined together") by using the '''+''' sign, just make sure string are only concatenating strings with strings (no lists, no numbers, no dictionaries, etc.):<source lang="python">
cd ~/ops435/lab4/
pwd #confirm that you are in the right directory
ls CheckLab4.py || wget matrix.senecachttps://raw.ongithubusercontent.cacom/~acoatleySeneca-willisCDOT/ops435/master/LabCheckScripts/CheckLab4.py
python3 ./CheckLab4.py -f -v lab4d
</source>

Navigation menu