Bored of learning python the regular way? Make a command line interface Hangman game and learn while you’re at it.
First try out the game for yourself! Run the following in your terminal,
pip install hangman-ultimate
hangman-ultimate
Never played the chalk board game of Hangman before? Rules are simple, you have to guess the name of a random animal letter by letter. Every wrong guess of a letter will bring the man closer to hanging. In retrospection, the game is a little dark for me to have played as a kid.
Alternatively, you can download the code from here.
Remember to like this post and start my Repository on GitHub if this post helped you!
Tear apart the code and make sure you have learnt the following at the end of it,
1. Opening a file and reading from it line by line.
2. Making multi-line strings.
3. Python Classes and Class instances(objects).
4. Class fields(variables) and methods(functions).
5. Passing class objects to functions.
6. Shared and non-shared fields(variables) amongst objects of same class.
7. Calling system(terminal) commands via the python script.
8. Catching an error using try except block.
9. Making basic command line animations.
10. Making programs compatible with both python 2 and python 3.
11. Pip packaging your python programs!
Got more ideas for CLI based games? Put them in the comments below!