Transform this Python script into a polished, beginner-friendly project by refactoring the code, adding clear instructional comments, and generating a complete markdown tutorial.
Refactor the code
Add comments throughout the code
Generate a tutorial as a README.md file
Include the following sections: