subject

So i do computer science and i am trying to add a function that counts how many wrong guesses the user does and draws a hangman. how can i do this?

nb: make sure it is correct before replying to me.
the code is

import random

word = ['ceraunophilia','clinomania','nyct ophilia','pluviophile','nyctophile' ,'palinoia','ceraunophile','cathars is','rhinotillexomania','numinous']
word = random. choice(word)

def setup_word():
guessed = ["_"]*len(word)
print('guess the word: ')
return guessed

def guess(letter, guessed):
wrong = 0
for i in range(len(word)):
if word[i] == letter:
guessed[i]=letter
found=true
if word[i] ! = letter:
wrong+=1

printguess(guessed)
return guessed

def printguess(guessed):
printguess=""
for i in guessed:
printguess+=i+" "
print(printguess)

def play(guessed):
if("".join(guessed) == word):
print('you win')
else:
play(guess(input('enter letter to guess'), guessed))

play(

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:30
Kto rozmawia z clamentain przez krótkofalówke w the walking dead która śledzi lee w 4 epizodzie
Answers: 1
question
Computers and Technology, 23.06.2019 03:30
How can you repin an image on your pinterest pin board a. click on the "repin" button b. click on the "add pin" button c. click on the "upload a pin" button d. click on the "save pin" button.
Answers: 2
question
Computers and Technology, 23.06.2019 06:30
To become an audio technician, the most successful tactics might include the following. (select all that apply). learning how to persuade other people gaining different types of experience in audio technology learning as much as possible about art history establishing a reputation as a reliable professional
Answers: 1
question
Computers and Technology, 24.06.2019 07:00
Why do we mark tlc plates with pencil and not with pen
Answers: 2
You know the right answer?
So i do computer science and i am trying to add a function that counts how many wrong guesses the us...
Questions
question
Mathematics, 08.12.2021 18:40
question
Computers and Technology, 08.12.2021 18:40
question
Arts, 08.12.2021 18:40
question
Mathematics, 08.12.2021 18:40
question
English, 08.12.2021 18:40
question
Social Studies, 08.12.2021 18:40
Questions on the website: 13722361