Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- word = 'bee'
- wordlen = len(word)
- currentstring = ('')
- print(wordlen)
- stars = "****************************************************"
- gameover = False
- regex = ('%.' + str(wordlen) + 's')
- currentstring = regex % stars
- numtries = 5
- print(currentstring)
- #inputletter = input('What letter would you like to add ')
- def checkforletter(inputletter):
- global currentstring
- numberofcharacters = 0
- for i in range(wordlen):
- letterofword = word[i]
- if inputletter == letterofword:
- #currentstring = (
- currentstring = currentstring[:i] + inputletter + currentstring[i+1:]
- numberofcharacters = numberofcharacters + 1
- print(numtries)
- else:
- #continue
- #numtries = numtries - 1
- #print('There are no' + inputletter + "s in the word")
- continue#print('You have ' + str(numtries) + ' remaining')
- return numberofcharacters
- while gameover == False:
- if numtries != 0:
- #print word
- gorf = input('Would you like to guess a letter, or try to guess the full word? ')
- if gorf == 'guess':
- print('You have ' + str(numtries) + ' guesses remaining')
- inputletter = input('What letter would you like to guess')
- if len(inputletter) == 1 and inputletter.isalpha() == True:
- lol = checkforletter(inputletter)
- if lol > 0:
- print('There are ' + str(lol) + str(inputletter) + "'s in the word!")
- print(currentstring)
- if currentstring == word:
- print('You won')
- gameover = True
- continue
- if lol == 0:
- numtries = numtries - 1
- print('There are no ' + inputletter + "'s in the word'")
- print('You have ' + str(numtries) + ' remaining')
- continue
- else:
- numtries = numtries - 1
- print('That was not a correct input')
- print('You have ' + str(numtries) + ' remaining')
- if gorf == 'full':
- guessword = input('Guess the word, If you get it wrong, the game will be over: ')
- if guessword == word:
- print('You won')
- gameover = True
- else:
- numtries = 0
- if numtries == 0:
- print('You lost')
- gameover = True
- #print('hello')
- continue
- print('endofcode')
- #if full
- #hfaufhafhajsdfhalsjdfhaslkjfhdaskjfahsdkjfhaksjfhda
- #else
- #try again.
- #*/
- #print(bruh.replace(bruh[0],'d'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement