[英]Beginner error Python and Atom
在Atom中使用Python代码遇到麻烦。 我正在使用“学习Python的艰辛方法”来练习一些编码。 当我将此代码输入Atom时,没有错误,但不会运行(是的,我已经安装了Script,并且在其他情况下也可以正常工作)。 在Atom的底部有一个小鸡蛋计时器,但是没有其他迹象表明我可能做错了什么。
print "How old are you?",
age = raw_input()
print "How tall are you?",
height = raw_input()
print "How much do you weigh?",
weight = raw_input()
print "So, you're %r old, %r tall and %r heavy." % (
age, height, weight)
当我这样输入
print "How old are you?",
print "How tall are you?",
print "How much do you weigh?",
print "So, you're %r old, %r tall and %r heavy." % (
age, height, weight)
该代码可以运行,但是会出现一个错误,即未定义年龄,这是有道理的,因为代码不完整。 这是否仅表明编辑器没有问题但代码没有问题? 所以请帮忙。 我是新来的。
尝试使用input()而不是raw_input()
。
尝试跟随
打印“所以,您是” + str(age)+“ old,” + str(height)+“高而” + str(weight)+“沉重”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.