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 weigh '%r' ") % ('age, height weight')
TypeError:%支持的操作数类型:' NoneType'和' str
答案 0 :(得分:2)
不要将变量放在引号中。而不是
print("So, you're '%r' old, '%r' tall and weigh '%r' ") % ('age, height weight')
把
print("So, you're '%r' old, '%r' tall and weigh '%r' " % (age, height weight))
答案 1 :(得分:0)
作为一个小伙子。实现这一目标的一种简单方法是在分配变量时询问您的问题
age = input("how old are you??")
height = input("How tall are you")
weight = input("How much do you weigh")
print("So, you're", age, "years old", height, "tall and weigh", weight)
答案 2 :(得分:0)
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 weigh '%r' " %(age, height, weight))
如果将变量放在引号中,它就变成了一个字符串。如果你要添加另一个变量,还要确保每个变量后面都有逗号。