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
- Error network error occurred - Guide
- Tentacle locker game - Download - Adult games
- Camp pinewood game - Download - Adult games
- Milfy city game - Download - Adult games
- Wvm 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
countandlimithave a colon (:) at the end instead of an equal sign (=). It should becount = 0andlimit = 5respectively. - Indentation Error: The lines after defining the variables
countandlimitshould be indented properly to be inside thehangmanfunction. 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.