import sys
def print_num(n):
print(n)
if __name__ == '__main__':
if len(sys.argv) == 1
print_num(sys.argv[1])
else:
print('incorrect number of arguments!')
import sys
def print_num(n):
print(n)
if __name__ == '__main__':
if len(sys.argv) == 2:
print_num(sys.argv[1])
else:
print('incorrect number of arguments!')
First argument is always name of script. So, you want to check for 2nd argument if exists.
2
u/kendall-mintcake Feb 21 '21
You're looking for the 'input' function
1
u/ballsacagawea69 Feb 22 '21 edited Feb 22 '21
You want something like :
1
u/MaddenTheDamned Feb 22 '21
Statistically, yes