Computers and Technology, 27.11.2019 03:31 DessAnnette2751
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(
Answers: 3
Computers and Technology, 23.06.2019 21:30
Write a fragment of code that reads in strings from standard input, until end-of-file and prints to standard output the largest value. you may assume there is at least one value. (cascading/streaming logic, basic string processing)
Answers: 3
Computers and Technology, 24.06.2019 02:10
Consider the usual algorithm to convert an infix expression to a postfix expression. suppose that you have read 10 input characters during a conversion and that the stack now contains these symbols: (5 points) | | | + | | ( | bottom |_*_| now, suppose that you read and process the 11th symbol of the input. draw the stack for the case where the 11th symbol is
Answers: 2
Computers and Technology, 24.06.2019 03:40
4. does the kernel phenotype distribution support the idea that the cob is the result of a dihybrid cross? what information supports your answer? if a dihybrid cross (i.e. f1 to f2 of standard mendelian crosses) is not indicated what conditions might contribute to this finding.
Answers: 2
Computers and Technology, 24.06.2019 07:50
Write a defining table and then a program that determines if you can sleep in or not. your program should get all its input from your computer’s clock. on all weekdays (monday through friday) that are not holidays, your program should output “get up! ” on all other days (weekends and holidays), your program should output “sleep in.” the three holidays that your program must check for are january 1 (new year’s day), july 4 (u.s. independence day), and december 25 (christmas). you don’t need to include other holidays in your program because most other holidays do not occur on a fixed day each year.
Answers: 1
So i do computer science and i am trying to add a function that counts how many wrong guesses the us...
Computers and Technology, 17.01.2020 21:31
Social Studies, 17.01.2020 21:31
Mathematics, 17.01.2020 21:31
Biology, 17.01.2020 21:31
Physics, 17.01.2020 21:31
Mathematics, 17.01.2020 21:31
Mathematics, 17.01.2020 21:31
Biology, 17.01.2020 21:31
Mathematics, 17.01.2020 21:31
Mathematics, 17.01.2020 21:31