所以,我对python是新手,对一般的编码也是半新手,我很难简单地打印变量。你知道吗
#startup
startup = "welcome to 'da spoopy house', type 'start'"
work = raw_input(startup)
<here is full code>
#functions
#keywords
varlook = "look"
vargo = "go"
varhouse = "house"
#story
st01 = "You are outside, its dusk. there is a house in front of you. both you and the house are surrounded by a forest"
st02 = "You walk up to the house, you notice a small yard with flowers lining the perimeter. As you step up to the door, you notice a small note attached to the door"
#instructions... ?
#action
print st01
raw_input()
if varlook in work:
print "%s" % st01
raw_input()
if raw_input == ("%s to %s") % (vargo, varhouse):
print "%s" % st02
raw_input()
问题就在这里
#action
print st01
raw_input()
if varlook in work:
print "%s" % st01
raw_input()
if raw_input == ("%s to %s") % (vargo, varhouse):
print "%s" % st02
raw_input()
当我键入所需的关键字(s)它只是停止程序,使我回到空闲状态。 感谢您的帮助。你知道吗
您似乎有一种误解,即调用函数
raw_input
,即发出raw_input()
,会将输入字符串赋给名为raw_input
的变量。你知道吗事实上,函数调用返回一个字符串,您当前对该字符串不做任何操作-该字符串将被垃圾收集并丢失,因为您没有任何对它的引用。你知道吗
将一个变量赋给返回值,然后在下面的代码中使用该变量。你知道吗
演示:
相关问题 更多 >
编程相关推荐