/
fotaxis
/
simple-python-app
Обзор
Документация
Войти
/
fotaxis
/
simple-python-app
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
sources/add2vals.py
25 строк
685 B
Giles Gaskell
Amend/fix output for 'add2values' when function is not used correctly
06 дек 2017, 06:57
06 дек 2017, 06:57
0fdc855
Код
Авторство
О чём код?
''' A simple command line tool that takes 2 values and adds them together using the calc.py library's 'add2' function. ''' import sys import calc argnumbers = len(sys.argv) - 1 if argnumbers == 2 : print("") print("The result is " + str(calc.add2(str(sys.argv[1]), str(sys.argv[2])))) print("") sys.exit(0) if argnumbers != 2 : print("") print("You entered " + str(argnumbers) + " value/s.") print("") print("Usage: 'add2vals X Y' where X and Y are individual values.") print(" If add2vals is not in your path, usage is './add2vals X Y'.") print(" If unbundled, usage is 'python add2vals.py X Y'.") print("") sys.exit(1)