198
edits
Changes
→PART 2 - WHILE LOOPS WITH ARGUMENTS
''' Understand While Loops and Arguments '''
:#Now lets make the same script more intelligent. Make a copy of '''lab2e.py''' and call it '''lab2f.py'''. Now modify '''lab2f.py''', modify the value of timer to user the first argument provided to the script. This will allow the argument to choose how long the timer is.
:::'''WARNING: When using arguments as numbers/integers or performing math on arguments you must wrap them in the int() function, for example: number = int(sys.argv[1])'''
::*The script should have a Shebang line
::*The script should import sys
::*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
blast off!
</source>
:::2. Download the check script and check your work. Enter the following commands from the bash shell.<source>
cd ~/ops435/lab2/