Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Code for Tiny Python Projects (Manning, 2020, ISBN 1617297518). Learning Python through test-driven development of games and puzzles.

License

Notifications You must be signed in to change notification settings

lundback/tiny_python_projects

 
 

Repository files navigation

Chapter 1: Hello, World!

https://www.youtube.com/playlist?list=PLhOuww6rJJNP7UvTeF6_tQ1xcubAs9hvO

Write a program to enthusiastically greet the world:

$ ./hello.py
Hello, World!

The program should also accept a name given as an optional --name parameter:

$ ./hello.py --name Universe
Hello, Universe!

The program should produce documentation for -h or --help:

$ ./hello.py -h
usage: hello.py [-h] [-n str]

Say hello

optional 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 test
pytest -xv test.py
============================= test session starts ==============================
...
collected 4 items

test.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 ===============================

About

Code for Tiny Python Projects (Manning, 2020, ISBN 1617297518). Learning Python through test-driven development of games and puzzles.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 96.4%
  • Shell 2.1%
  • Makefile 1.4%
  • Dockerfile 0.1%