Changes

Jump to: navigation, search

OPS435 Python Lab 1

119 bytes removed, 08:48, 16 May 2017
no edit summary
==== String Variables ====
First make a new variable containing a value.'''Perform the following steps:'''
:#First, let's make a new variable containing a value by issuing the following command:<presource>
name = 'Thomas'
</presourceInspect :#Iss the following command to inspect the value. of the variable"<presource>
name
</presource:#Print the value to the screen. :<presource>
print(name)
</presource:#Now lets try something new, we are going to print out the string and concatenate/combine it with another string. The plus sign can be used to join 2 strings together. However, make sure that your variable is always outside the quotes, or it will not resolve to a value. <presource>
print('I have a friend named ' + name)
</presource=== Part 3 - Evaluation === Create :#To gain practice, create a python script: (called lab1b.py) with the following content and details:::* The script should have a Shebang line::* The script should use a single variable called "name"::* The value of the "name" variable should be "Isaac"::* The script, when executed, should print out "How old are you Isaac?" Example ::*Sample run: <presource>
%cd ~/ops435/lab1/
%run ./lab1b.py
How old are you Isaac?
</presource><br><br> Try the check script as you are working through a script to sometimes get hints.<br><br> === Part 3 - Lab Check lab1b === This course is designed with a unit testing suite, which can be used to look at the scripts you write and give real-time feedback. This feedback is not perfect, however it may offer some hints if you get stuck with a error. It can also be used to make sure you are on the write track, :#Download and show progress. Download run the check checking script. Enter the following commands from the bash shell.:<presource>
cd ~/ops435/lab1/
pwd #confirm that you are in the right directory
ls CheckLab1.py || wget matrix.senecacollege.ca/~acoatley-willis/CheckLab1.py
python ./CheckLab1.py -f -v lab1b
</presource:#Before moving on to the next step proceeding, make sure certain that you identify any and all errors in "lab1a.py". When the check script tells you everything is "ok", you may procede to the next step.
=== PART 4 - INTEGERS = Integer Variables====
Lets enter into IPython to test out variables.
13,420
edits

Navigation menu