Changes

Jump to: navigation, search

OPS435 Python Lab 1

62 bytes removed, 13:14, 1 August 2017
PART 2 - Setting up Your Python Environment For Labs
<li style="margin-left:25px;">
Perform the following steps to evaluate this unit. Run these check scripts regularly as you work through the labs, they may give you hints if you get stuck.</li>
:<source lang="bash">
cd ~/ops435/lab1/
pwd #confirm that you are in the right directory
:'''Perform the following steps:'''
:# Using a text editor, open a new text file called '''lab1a.py''':<source lang="bash">
vim ~/ops435/lab1/lab1a.py
</source>
:#Write the following code into our python file. Note the she-bang line at the top of the file to run this script in the python3 environment. You will need to add this she-bang line for all python scripts you create for this course.<source lang="python">
#!/usr/bin/env python3
</source>
:#Now, from the Bash shell we will give it the correct Linux permissions in order to run your newly-created python script. This is just showing the multiple ways you can use this python script. You are not required to have IPython running on a system, however hopefully we can use IPython's powerful features to our advantage.
:# Run your python script by issuing the following commands:<source lang="bash">
chmod 755 ~/ops435/lab1/lab1a.py
python3 ~/ops435/lab1/lab1a.py
</source>
:#Download the check script and check your work. Enter the following commands from the bash shell.<source lang="bash">
cd ~/ops435/lab1/
pwd #confirm that you are in the right directory

Navigation menu