Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #HANGMAN
- from turtle import*
- #gallow
- ht()
- pensize(6)
- pu()
- lt(90)
- fd(100)
- pd()
- fd(20)
- rt(90)
- fd(100)
- rt(90)
- fd(300)
- lt(90)
- fd(10)
- rt(180)
- fd(200)
- pu()
- home()
- sety(100)
- pd()
- lt(180)
- pensize(3)
- word = list(input('Enter a word: '))
- guess = []
- wrong = []
- ind = 0
- att = 0
- fail = 0
- for i in range(40):
- print('.')
- print('Start!')
- for i in range(len(word)):
- guess += '_'
- print(*guess)
- while True:
- letter = input('Enter a letter: ')
- if letter in word:
- print('Correct letter')
- while ind < len(word):
- if letter == word[ind]:
- guess[ind] = letter
- ind += 1
- att += 1
- else:
- wrong.append(letter)
- att += 1
- fail += 1
- print('Wrong letter')
- if fail == 1:
- circle(30)
- elif fail == 2:
- pu()
- lt(90)
- fd(60)
- pd()
- fd(100)
- elif fail == 3:
- pu()
- bk(70)
- rt(110)
- pd()
- fd(60)
- elif fail == 4:
- pu()
- rt(180)
- fd(60)
- rt(320)
- pd()
- fd(60)
- elif fail == 5:
- pu()
- rt(180)
- fd(60)
- lt(70)
- fd(70)
- pd()
- rt(35)
- fd(75)
- elif fail == 6:
- pu()
- rt(180)
- fd(75)
- rt(105)
- pd()
- fd(75)
- print('Game over. The word was:', *word)
- break
- print(*guess)
- if len(wrong) > 0:
- print('Wrong letters:', *wrong)
- print('_________________________________')
- ind = 0
- if guess.count('_') == 0:
- print('You guessed the word in',att,'tries')
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement