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 01:30
What kind of motivation is katrina showing? use the drop-down menu to complete the statement. katrina is using motivation because she is personally interested in learning more.
Answers: 2
question
Computers and Technology, 23.06.2019 03:10
Acomputer has a two-level cache. suppose that 60% of the memory references hit on the first level cache, 35% hit on the second level, and 5% miss. the access times are 5 nsec, 15 nsec, and 60 nsec, respectively, where the times for the level 2 cache and memory start counting at the moment it is known that they are needed (e.g., a level 2 cache access does not even start until the level 1 cache miss occurs). what is the average access time?
Answers: 1
question
Computers and Technology, 23.06.2019 08:00
Match the items with their respective descriptions.
Answers: 1
question
Computers and Technology, 24.06.2019 03:00
Will do anything for brainlest so can you guys me out i will try my best to you out
Answers: 1
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
History, 23.10.2020 06:01
question
Mathematics, 23.10.2020 06:01
Questions on the website: 13722359