import time
import random    #for random words

name = input("what is your name? ")
print("Hello, " + name, "Welcome to Hangman.Time to Play!!")

#wait for 1 sec
time.sleep(1)

print("Start guessing..")
time.sleep(0.5)

#for random words
kelimeler = ["ability","about","above","absolute","accessible","accommodation",
             "accounting","beautiful","bookstore","calculator","clever","engaged",
             "engineer","enough","handsome","refrigerator","opposite","socks",
             "interested","strawberry","backgammon","anniversary","confused",
             "dangerous","entertainment","exhausted","impossible","overweight",
             "temperature","vacation","scissors","accommodation","appointment",
             "decrease","development","earthquake","environment","brand",
             "environment","necessary","luggage","responsible","ambassador",
             "circumstance","congratulate","frequent",]

#here we set the secret word
#word = "minimilitia"

word = random.choice(kelimeler)  #variable name in bracket


#create a variable with an empty value to store guess letters and word
guesses =" "

#define no. of turns to guess(no. of chances to guess)
turns = 10

#check if the turns are more than 0
#first ma while loop to create dashes then i/p guesses is taken from player
while(turns > 0):

    #make a counter that starts with 0
    failed = 0

    #for every character in secret word 
    for char in word:       #in return true if the char is in the word else
                            #returns false

    #see if the char is in player's guess
        if char in guesses:
            print(char)

        else:
            #if not found ,print dash
            print("_")

            failed +=1

    if failed == 0:
        print("you won")
        break

    guess = input("guess a character: ")

    #set the players guess to guesses

    guesses += guess

    #if the guess is not found in secret word
    if guess not in word:
        #turns counter decreases with 1
        turns -= 1

        print("wrong")

        #how many turns are left
        print("you have", + turns , 'more guesses')

        #if the turns are equal to 0
        if turns == 0:
            print("You lose")
            

    
        
    
