Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 2

205 bytes added, 10:52, 26 May 2017
PART 1 - Understanding WHILE Loops
== PART 1 - Understanding WHILE Loops ==
'''While WHILE loops''' use a the same type of conditions found in if statements. While the condition is True, the code indented under the while loop will be repeated. When the condition becomes False the loop will stop repeating.
:'''Perform the following steps'''
:#Open ipython3<source>
ipython3
</source>A WHILE loop can be used to create a Determinant loop. That expression means that the number of loops (also referred to as: 'repetitions' or 'iterations') are already known or 'determined'. Below is a program determinant WHILE loop that will count to 5. Each time the loop is run, it will add one to the count variable, increasing the variables number.<br><br>
:#Issue the following at the ipython3 shell to see what happens:<source>
count = 0
13,420
edits