Changes

Jump to: navigation, search

OPS435 Python Lab 2

18 bytes added, 02:07, 25 May 2017
PART 3 - WHILE LOOPS WITH IF STATEMENTS
:#Now lets make the same script EVEN more intelligent. Make a copy of '''lab2f.py''' and call it '''lab2g.py'''. Now modify '''lab2g.py''', add a if statement to the script that checks to see if a argument was entered. If a argument was entered use that number for the timer, if no argument was entered, timer should equal 3.
:::'''WARNING: When using arguments as numbers/integers or performing math on arguments you must wrap them in the int() function: number = int(sys.argv[1])''':::'''WARNING: Remember to check the number of arguments using len(sys.argv) in a if statement'''
::*The script should have a Shebang line
198
edits

Navigation menu