Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 2

95 bytes added, 12:19, 26 May 2017
PART 3 - WHILE Loops With IF Statement
:#Modify '''lab2f.py''' to change the initial value of the variable '''count''' to the first argument when running your Python script. '''WARNING:''' When using arguments as numbers/integers or performing math on arguments you must wrap them in the int() function, for example: '''count = int(sys.argv[1])'''
:::'''Additional Input / Output / Processing Requirements'''
:::*The script should have a Shebang line
:::*The script should import sys
:::*The script should use a variable named timer with the value of int(sys.argv[1])
:::*The script should have a while loop that repeats until timer equals 0
:::*The script should print the EXACT OUTPUT as shown
::*The script should have a Shebang line::*The script should import sys::*The script should use a variable named timer with the value of int(sys.argv[1]) ::*The script should have a while loop that repeats until timer equals 0::*The script should print the EXACT OUTPUT as shown:::'''Sample run 1:'''<source>
run lab2f.py 10
10
blast off!
</source>
:::'''Sample run 2:'''<source>
run lab2f.py 3
3
blast off!
</source>
:::23. Download the check script and check your work. Enter the following commands from the bash shell.<source>
cd ~/ops435/lab2/
pwd #confirm that you are in the right directory
python3 ./CheckLab2.py -f -v lab2f
</source>
:::34. Before proceeding, make certain that you identify any and all errors in "'''lab2d.py"'''. When the check script tells you everything is "ok"'''OK''', you may procede proceed to the next step.
== PART 3 - WHILE Loops With IF Statement==
:::3. Before proceeding, make certain that you identify any and all errors in "lab2d.py". When the check script tells you everything is "ok", you may procede to the next step.
<br><br>
= LAB 2 SIGN-OFF (SHOW INSTRUCTOR) =
13,420
edits