Modify lab2f.py (attached pic) , add an IF statement to the script that checks to see if
Fantastic news! We've Found the answer you've been seeking!
Question:
- Modify lab2f.py (attached pic), add an 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.
timer = int(sys.argv[1])
Remember to check the number of arguments in an IF statement using:
len(sys.argv)
Additional Input / Output / Processing Requirements
- The script should have a Shebang line
- The script should have a comment line which contains the word "Author:" and your full name
- The script should have another comment line which contains the word "Author ID:" and your seneca_id
- The script should have another comment line which contains the word "Date Created:" and the actual date in "yyyy/mm/dd" format
- The script should import sys
- The script should assign the value of 3 to an object named timer when there is no arguments provided.
- The script should assign the value of int(sys.argv[1]) if an object named timer when one command line argument (sys.argv[1]) are entered
- The script should have a WHILE loop that repeats until (and not including when) timer equals 0
- The script should print the EXACT OUTPUT as shown
Sample run 1:
./lab2g.py 5
5
4
3
2
1
blast off!
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date: