Python Projects & Skills / Games
Lesson 8 of 28
Hangman
Show underscores for unguessed letters and track wrong guesses. Sets make it easy to check which letters are left.
Key points
- Store guessed letters in a set
- Build the display with a comprehension
- Limit wrong guesses
shown = " ".join(c if c in guessed else "_" for c in word)Quiz · +10 XP
Which data type is best for storing guessed letters?
Log in to save progress and earn XP.