Computers and Technology

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(

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 18:30, Akkenson17871
The "instance" relationship shows that something is an object of a
Answers: 1
image
Computers and Technology, 22.06.2019 22:30, hmontalvo22
Who needs to approve a change before it is initiated? (select two.) -change board -client or end user -ceo -personnel manager -project manager
Answers: 1
image
Computers and Technology, 23.06.2019 07:50, kmart4062
Apython programming question: assume s is a string of lower case characters. write a program that prints the number of times the string 'bob' occurs in s. for example, if s = 'azcbobobegghakl', then your program should print number of times bob occurs is: 2
Answers: 3
image
Computers and Technology, 23.06.2019 21:00, shyshy1791
Which set of steps will organize the data to only show foods with more than 100 calories and rank their sugar content from greatest to least?
Answers: 1
Do you know the correct answer?
So i do computer science and i am trying to add a function that counts how many wrong guesses the us...

Questions in other subjects: