0% found this document useful (0 votes)
24 views1 page

Bubble Sort Algorithm

The document contains a Python script for a hangman game. It initializes a list of words and allows the player to guess letters, updating the display of the word based on correct guesses. Functions are provided to check guessed letters and update the word's display accordingly.

Uploaded by

letsgomidas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views1 page

Bubble Sort Algorithm

The document contains a Python script for a hangman game. It initializes a list of words and allows the player to guess letters, updating the display of the word based on correct guesses. Functions are provided to check guessed letters and update the word's display accordingly.

Uploaded by

letsgomidas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import random

import time

lives = 7
words = ["python", "hangman", "programming", "challenge", "game"]
random_word = random.choice(words)

def check_letter(word, guess):


for i in word:
if i == guess:
return True
return False

def update_word(word, guessed_letter):


display = ""
for i in word:
if i in guessed_letter:
display += i
else:
display += "_"
return display

You might also like