Last active
February 24, 2021 17:28
-
-
Save brentxphillips/a08086621536a44c49aef671e07d95d2 to your computer and use it in GitHub Desktop.
Command line arguments example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Brent Phillips | |
# CS5001/5003 Spring 2021 | |
# Lab 3 | |
# Instructions | |
# Command line arguements example | |
# imports system package | |
import sys | |
# if this file is run in the terminal then list prints file name with brackets aroudn it | |
print(sys.argv) | |
# if this file is run in the terminal then list prints file name without brackets aroudn it | |
print(sys.argv[0]) | |
# if terminal input is file name + three times 3, then output is below | |
a= sys.argv[3] | |
print(a * 3) | |
b = int( sys.argv[3]) | |
print( b * 3) | |
# file mame | |
# 333 | |
# 9 | |
# evaluate command line inputs | |
if int(sys.argv[3]) == 3: | |
print("three") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment