Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

  1. 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!

 

 

 

#! /usr/bin/env python3 #Author: Seneca Id 39103436 #Author ID: 39103436 # Date Created: 2020/09/21 import sys timer = int (sys.argv[1]) while timer > 0: print(timer) timer 1 print("blast off!")

Step by Step Solution

3.44 Rating (157 Votes )

There are 3 Steps involved in it

Step: 1

There are some syntax errors in your provided script Her... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

Compute cost of goods sold for 2017 using the following information

Answered: 1 week ago