Add keyboard interrupt

This commit is contained in:
2022-09-17 21:07:35 +12:00
parent f09d4ba213
commit 20d5499bf9

View File

@@ -4,7 +4,8 @@ random.seed()
number = random.randrange(100, 999)
number = list(str(number))
guesses = 0
while True:
try:
while True:
if guesses == 5:
print("You loose!")
@@ -31,3 +32,5 @@ while True:
print(hint[index], end=" ")
guesses += 1
print("\n")
except KeyboardInterrupt:
pass