テキストベースのゲーム用にこのコードを作成しましたが、次のエラーが表示されます
line 1, in <module>
userInput = input("Please enter a direction in which to travel: ")
File "<string>", line 1, in <module>
NameError: name 'north' is not defined
これが私のコードです
userInput = input("Please enter a direction in which to travel: ")
Map = {
'north':'that way leads to the kitchen',
'south':'that way leads to the dining room',
'east':'that way leads to the entry',
'west':'that way leads to the living room'
}
if userInput == north:
print Map['north']
elif userInput == south:
print Map['south']
elif userInput == east:
print Map['east']
elif userInput == West:
print Map['west']
elif userInput == '':
print "Please specify a various direction."
else:
quit
助けてくれてありがとう