I have this code:
direction = input("Do you go left, right, up or down?! Forwards would also be an option: ")
if direction == "left":
print("You turn left and are confronted by a group of 5 goblins.")
fight_goblin = input('''You have two choices, die, or beat them to death with their own weapons.
Which one do you choose insolent one? Use 1 or 2 to select: ''')
if fight_goblin == "1":
print('''You turn and run, but, alas, the goblins have legs.
They run up to you and beat you to death. RESTART!''')
elif fight_goblin == "2":
print('''The first goblin rushes towards you menacingly.
You grab his mace and throw him behind you. The mace falls into your hand.
The second and third goblin, now enraged, speed towards you; spears in hand.
You slam the mace into the face of one of the goblins and he falls backwards
killing his companion in the aftermath.
The remaining goblins flee in terror.
BATTLE WON! You collect obvious resources from the goblins bodies.
+1 Mace +1 spear +200 gold.''')
But when I run it people can type in other stuff and it will just freeze. I know how to restrict words and letters but how do I restrict Numbers? I restricted the words like this:
while True:
pick = input("Do you pick up the slab? Yes/No ").lower()
if pick == 'yes':
print("You pick up the slab and begin reading.")
break
elif pick == 'no':
print("You walk forwards and land facefirst onto the slab.")
break
else:
print("You have to choose Yes or No")