xiaodi 发表于 2018-12-1 00:35:50

Python问题


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)
运行结果

求解

xie仗剑天涯 发表于 2018-12-29 14:46:18

用的是python 2 还是 python 3 , python 2 的话语法是没错的 ,, python 3 需要这样改
print ("How old are you?")
age = input()
print ("How tall are you?")
height = input()
print ("How much do you weigh?")
weight = input()
print ("So, you're %r old, %r tall and %r heavy." % (age, height, weight))

xiaodi 发表于 2018-12-31 00:07:29

xie仗剑天涯 发表于 2018-12-29 14:46
用的是python 2 还是 python 3 , python 2 的话语法是没错的 ,, python 3 需要这样改
print ("How old ar ...

多谢解惑
页: [1]
查看完整版本: Python问题