File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change 5656 break
5757 # Get user input
5858 user_inp = input (">>" )
59+
60+ # Check if user wants to exit the program
61+ if user_inp == "q" :
62+ break
63+
5964 # Check if the word given by the user is 5 characters long
6065 if not len (user_inp ) == 5 :
6166 print ("Your input must be 5 letters long" )
6267 continue
63-
68+
6469 # Check if the word given by the user is in the dictionary
6570 if not user_inp in dictionary :
6671 print ("Your word is not in the dictionary" )
6772 continue
68-
73+
6974 # Check if the word given by the user is correct
7075 if user_inp == word :
7176 print (f"You guessed the word in { tries } tries" )
7277 break
7378
7479 letter = 0
7580 for i in word :
76- pass
81+ if user_inp [letter ] in word :
82+ if user_inp [letter ] == i :
83+ print (f"{ user_inp [letter ]} is in the correct place" )
84+
7785
7886 """letter = 0
7987 for i in word:
8290 elif user_inp[letter] in word:
8391 print(f"{user_inp[letter]} is in the word, but not in the correct position")
8492 letter += 1"""
85-
93+
8694 tries += 1
87- print (tries )
95+ print (tries )
You can’t perform that action at this time.
0 commit comments