Day 7 of 100 Days of Python: Hangman Project 🔡🪢

Mirza Mohammed Baig
3 min readJun 27, 2024

--

I’m happy to share my journey on Day 7️⃣ of the 100 Days of Code Challenge. Today was all about building the classic Hangman game in Python, diving into more complex problem-solving, and refining our coding skills. 💻

Goals for the Day: 🎯
- Develop a fully functional Hangman game.
- Utilize for and while loops, if/else statements, lists, strings, range, and modules.

Key Concepts Covered:

- How To Break Down A Complex Problem Into A Flow Chart
We started by learning how to break down the Hangman game into manageable parts using a flow chart. This helped in visualizing the problem and planning our approach step-by-step.

Challenge 1 — Picking a Random Word & Checking Answers
Our first challenge was to select a random word from a list and check the user’s input against this word. This introduced us to the random module and basic input validation.

Challenge 1 Solution — How To Check The User’s Answer
We explored different methods to compare the user’s guess with the letters in the chosen word, ensuring accurate validation.

Challenge 2 — Replacing Blanks with Guesses
Next, we worked on replacing the blanks in the word with the user’s correct guesses, updating the display to show progress.

Challenge 2 Solution — How to Replace the Blanks
We learned how to iterate over the chosen word and replace the blanks with correct guesses, enhancing the user’s feedback.

Challenge 3 — Checking If the Player Has Won
This challenge involved checking if the player has successfully guessed all the letters in the word, indicating a win.

Challenge 3 Solution — How To Check If the Player Has Won
We discussed efficient ways to compare the guessed letters with the chosen word to determine if the game has been won.

Challenge 4 — Keeping Track Of The Player’s Lives
To add more complexity, we implemented a system to track the player’s lives, decreasing with each incorrect guess.

Challenge 4 Solution — Keeping Track Of The Player’s Lives
We learned to manage the player’s lives and update the game status based on correct and incorrect guesses.

Challenge 5 — Improving the User Experience
Our final challenge was to enhance the user experience by adding ASCII art and improving the overall UI of the game.

Challenge 5 Solution — How To Add ASCII Art & Improve the UI
We integrated ASCII art to visually represent the hangman’s progress and polished the UI to make the game more engaging.

Replit: https://replit.com/@mbaig9/Day7100DaysofPython-MMB-Hangman#main.py 💻

Github: https://github.com/M1RZAB4IG/100DaysofPythonCodeChallenge/tree/main/Day7-HangmanProject 💻

Summary:
Day 7 was incredibly rewarding as we built the Hangman game from scratch. The challenges were tough but enjoyable, and the step-by-step approach helped in understanding how to tackle complex problems. Each part of the project reinforced key programming concepts, and the final product was both fun and educational. The game is tougher than you’d think lol 😂

Stay tuned for more updates as I continue my coding journey! Feel free to connect and share your own coding journey! 🚀💻🐍

#Python #Coding #100DaysofPythonChallenge #Learning #Programming #Hangman #Replit #Medium #SoftwareDevelopment

--

--

Mirza Mohammed Baig
Mirza Mohammed Baig

Written by Mirza Mohammed Baig

A Muslim Man Pursuing Islamic Self-Improvement Interests: Islam | Self Improvement | SWE | Entrepreneurship | Digital Marketing

No responses yet