Python Hangman Game Program Error
Solved/Closed
gulshan212
Posts
5
Registration date
Monday November 28, 2022
Status
Member
Last seen
April 25, 2023
-
Updated on Apr 21, 2023 at 01:20 PM
seogbtools - Jun 18, 2023 at 08:57 AM
seogbtools - Jun 18, 2023 at 08:57 AM
Related:
- Python Hangman Game Program Error
- Game vault download - Download - Online gaming and betting
- College brawl game - Download - Adult games
- Tentacle locker game - Download - Adult games
- Milfy city game - Download - Adult games
- Kunoichi trainer game - Download - Adult games
2 responses
Hi,
It seems like there are a few errors in your Hangman game code.
- Syntax Error: The lines where you define the variables
count
andlimit
have a colon (:) at the end instead of an equal sign (=). It should becount = 0
andlimit = 5
respectively. - Indentation Error: The lines after defining the variables
count
andlimit
should be indented properly to be inside thehangman
function. Make sure to indent the following lines so that they are correctly nested within the function.
Here is the corrected code:
import random import time import os def play_again(): question = 'Do you want to play again? y = yes, n = no \n' play_game = input(question) while play_game.lower() not in ['y', 'n']: play_game = input(question) if play_game.lower() == 'y': return True else: return False def hangman(word): display = '_' * len(word) count = 0 limit = 5 # Rest of your code...
Please review these changes and run your code again. If you encounter any further errors or issues, feel free to ask for additional assistance.