Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 2

117 bytes added, 19:10, 25 May 2017
PART 2 - Arguments
:#Modify '''lab2c.py''' so that it uses '''sys.argv[1]''' and '''sys.argv[2]''' instead of the '''input()''' functions that was used in your previous ''lab2b.py'' script.
Example output is shown below:::'''Input / Output Requirements'''
:::*The script should have a '''Shebang line''':::*The script should contain import sys:::*The script should use a variable called "'''name"''':::*The script should use a variable called "'''age"''':::*The script should use '''sys.argv[1] ''' (first argument):::*The script should use '''sys.argv[2] ''' (second argument):::*The script should store the values in the correct variables(including case sensitivity):::*The script should print the EXACT OUTPUT as shown(including case sensitivity):::'''Sample run 1:'''<source>
run lab2c.py Jon 20
Hi Jon, you are 20 years old.
</source>
:::'''Sample run 2:'''<source>
run lab2c.py Jen 25
Hi Jen, you are 25 years old.
13,420
edits