Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 2

145 bytes removed, 10:14, 22 January 2018
PART 2 - Using IF/ELIF/ELSE Statements
#For the following examples, try changing the numbers in the variables to get different results.
#Create one or more new files for testing the following steps (you won't need to submit them).
#Let's perform use an IF statement testing a condition of two variable values. In this case, if variable 'a' is greater than variable 'b', then print a message, if False, do nothing.<source lang="python">
a = 10
b = 15
print('a is greater than b')
</source>What happened? Let's now use an IF/ELSE statement.<br><br>
#Issue Try the following at the ipython3 shellcode instead:<source lang="python">
a = 10
b = 15
print('Therefore, a is equal to b')
</source>
#You are NOT required to create a Python script for this section or run the checking script. Proceed to INVESTIGATION 3.
<br><br>
= INVESTIGATION 3: USING LOOP STATEMENTS =