direction = input("enter a direction: ")
if direction != "quit" and direction != "go north" and direction != "go south" and direction != "go east" and direction != "go west" and direction != "go up" and direction != "go down" and direction != "look":
print ("please enter in the following format, go (north,east,south,west,up,down)")
elif direction == "quit":
print ("OK ... but a small part of you may never leave until you have personally saved Muirfieland from the clutches of evil .. Bwahahahahahah (sinister laugh) ... the game should then end.")
elif direction == "look":
print ("You see nothing but endless void stretching off in all directions ...")
else:
print ("You wander of in the direction of " + direction)
我需要知道如何在 python 中做到这一点。例如,我需要扫描用户输入的前 2 个字母
i = user_input
#user inputs go ayisgfdygasdf
我需要它能够扫描用户输入,检查前 2 个字母是否正常,如果它们正常,但它无法识别第二个单词,在这种情况下是“ayisgfdygasdf”,然后打印“对不起,我做不到那”