Changes

Jump to: navigation, search

OPS435 Python Lab 2

160 bytes removed, 12:37, 26 May 2017
PART 3 - Using WHILE Loops With IF Statements
:#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, then by default, the timer should equal 3.
<blockquote style="margin-left:35px;">{{Admon/important|style="padding-left:25px"|Number of Arguments with len(sys.argv)ADDITIONAL WARNINGS|If When using arguments as numbers/integers or performing math on arguments you are running must wrap them in the '''lenint(sys.argv)''' function in ipython3, the number of arguments returned will be always be '1'. This number will always be one higher than the actual number of arguments entered, since it also counts the script name as a argument.:}}</blockquote>
<blockquote style="margin-left:35px;">{{Admon/important|style="padding-left:25px"|Additional WARNINGS|When using arguments as numbers/integers or performing math on arguments you must wrap them in the int() function: count = int(sys.argv[1])<br><br>Remember to check the number of arguments using len(sys.argv) in an IF statement}}</blockquote>
13,420
edits

Navigation menu