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中做到這一點。 我需要掃描第一用戶輸入兩個字母 例如掃描用戶輸入python
i = user_input
#user inputs go ayisgfdygasdf
我需要它能夠掃描用戶輸入,檢查前2個字母去,如果他們都去,但它不承認在這種情況下是「ayisgfdygasdf」,然後打印「第二個單詞,然後打印」對不起,我不能這樣做「
不是真的,如果程序識別出第一個單詞是「去」,但不承認第二個單詞,然後python打印「對不起,我不能這樣做」 – user2232076