Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 1

8 bytes added, 11:57, 6 September 2017
PART 1 - Installing Your Linux Distribution
<blockquote style="margin-left:35px;">{{Admon/important|style="padding-left:25px"|Unit Evaluation Scripts|Each '''Part''' (within an 'Investigation) is referred to as a '''Unit'''. Each Unit will require that the student download and run a '''Unit Evaluation Script''', which provides the OPS435 student "real-time feedback" of their completed work.<br>This feedback is not considered to be perfect or fool-proof; however, it may provide feedback (hints) in case a student gets stuck or experiences an error when performing administration tasks or when creating their Python scripts. These unit evaluation scripts can also be used to confirm that the student's Python script is on the right track, and provide a consistent record of their Python scripting progress throughout their labs.}}</blockquote>
<!--<ol><li value="3" style="margin-left:25px;">Issue the following commands (as a regular user) in order to setup, download and run the first unit evaluation script:<br><source lang="bash">
mkdir -p ~/ops435/lab1/
cd ~/ops435/lab1/
python3 ./CheckLab1.py -f -v lab0a
</source></li>
<li style="margin-left:25px;">Before moving on to the next step make sure you identify any and all errors from the check script.<br>When the check script tells you everything is "ok" for "lab0a", you may proceed to the next step.<br><br></li></ol>-->
=== PART 2 - Setting up Your Python Environment For Labs ===
:# Issue the following function:<br><source>
print('hello world')
</source>This time we should now see that the python function "print()" has outputted to the screen the words 'hello world'. In python a word or a bunch of characters like 'hello world' is called a 'string'. So what we did In the above isexample, passed a '''string''' was passed as a '''argument''' to the print '''function'''. These words are important for understanding and talking about different aspects of code.<br><br>
:# Note that there are similarities between the Python print() function and the Bash echo command, but Python is more picky than bash (which is a good thing). Try to run print without the brackets or without the quotes to see what happens.
<blockquote style="margin-left:35px;">{{Admon/tip|Reading errors|One of the things that makes a good programmer is debugging skills. The first and most important debugging technique is reading and understanding error messages. Try to understand what the errors are saying even if you think you already know what the problem is and already have some idea about how to fix it.}}</blockquote>
198
edits