We want to accomplish more clean and readable code with the help of modules.
Modules are just python files that normally contain code that are related.
You'll be refactoring your code to show how you can group functionality into modules and call them using import statements.
At the end of this, your hangman.py should be split into:
hangman/lib/utils.py - containing your get_target_word function and any future utility functions
hangman/lib/core.py - containing the hangman class and any future core logic
hangman/main.py - containing the code for initializing and running the hangman game.
Notes:
Call needed code using import statements in your main.py
Read about the use of __init__.py python files in python packages.
We want to accomplish more clean and readable code with the help of modules. Modules are just python files that normally contain code that are related.
You'll be refactoring your code to show how you can group functionality into modules and call them using import statements.
At the end of this, your hangman.py should be split into:
get_target_word
function and any future utility functionsNotes:
import
statements in yourmain.py
__init__.py
python files in python packages.Extra: Read about basics of Databases, SQL and the sqlite3 python library. Helpful links: https://learntocodewith.me/posts/sql-guide/ https://www.digitalocean.com/community/tutorials/how-to-use-the-sqlite3-module-in-python-3