def Forest(Health,Hunger):
print'You wake up in the middle of the forest'
Inventory = 'Inventory: '
Squirrel = 'Squirrel'
while True:
Choice1 = raw_input('You...\n')
if Choice1 == 'Life' or 'life':
print('Health: '+str(Health))
print('Hunger: '+str(Hunger))
elif Choice1 == 'Look' or 'look':
print 'You see many trees, and what looks like an edible dead Squirrel, \na waterfall to the north and a village to the south.'
elif Choice1 == 'Pickup' or 'pickup':
p1 = raw_input('Pickup what?\n')
if p1 == Squirrel:
if Inventory == 'Inventory: ':
print'You picked up a Squirrel!'
Inventory = Inventory + Squirrel + ', '
elif Inventory == 'Inventory: Squirrel, ':
print'You already picked that up!'
else:
print"You can't find a "+str(p1)+"."
elif Choice1 == 'Inventory' or 'inventory':
print Inventory
我正在努力做到这一点,当它说你...时,你可以输入 Life、Pickup、Look 或 Inventory。我在这个程序上有更多的代码我只是向你展示了一部分。但每次我运行它时,即使你输入“Pickup”或“Look”或“Inventory”,它总是显示“Life”部分。请帮忙!谢谢,约翰
编辑:我认为这只是一个间距问题,但我不确定它之前是否运行良好......