https://www.youtube.com/playlist?list=PLhOuww6rJJNP7UvTeF6_tQ1xcubAs9hvO
Write a program to enthusiastically greet the world:
$ ./hello.pyHello, World!
The program should also accept a name given as an optional --name
parameter:
$ ./hello.py --name UniverseHello, Universe!
The program should produce documentation for -h
or --help
:
$ ./hello.py -husage: hello.py [-h] [-n str]Say hellooptional arguments: -h, --help show this help message and exit -n str, --name str The name to greet (default: World)
Run pytest -xv test.py
(or make test
) to ensure you pass all the tests:
$ make testpytest -xv test.py============================= test session starts ==============================...collected 4 itemstest.py::test_exists PASSED [ 25%]test.py::test_usage PASSED [ 50%]test.py::test_default PASSED [ 75%]test.py::test_input PASSED [100%]============================== 4 passed in 0.41s ===============================
Reviews
There are no reviews yet.