Oct-07-2019, 02:02 PM
There's a problem with line 26 (I think, maybe this was intentional). The first word I got was 'prosecutor'. I got to 'prosecut--', but then couldn't go any farther. If I guessed 'o' or 'r' it just refound the ones at the beginning of the word.
I would generally solve this with a try/except block in a loop, using the start parameter of the index method:
I would generally solve this with a try/except block in a loop, using the start parameter of the index method:
start = 0 while True: try: locate = letter_list.index(guess_letter, start) spaces[locate] = guess_letter start = locate + 1 except: breakYou can also do it in a loop:
start = 0 for letter in range(letter_list.count(guess_letter)): location = letter_list.index(guess_letter, start) spaces[locate] = guess_letter start = locate + 1Also, I would inform the user of how many guesses they have left.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures