【发布时间】:2015-01-31 21:01:18
【问题描述】:
我正在运行这个:
def add (a, b):
print "ADDING %d + %d" % (a, b)
return a + b
def subtract (a, b):
print "SUBSTRACTING %d - %d" %(a, b)
return a -b
def multiply (a, b):
print "MULTIPLYING %d * %d" % (a, b)
return a * b
def devide (a, b):
print "DEVIDING %d / %d" % (a, b)
return a / b
print " lets do some math with just function!"
age = add(30, 5)
hight = subtract (78, 4)
weight = multiply (90, 2)
iq = divide = (100, 2)
print "Age: %d, Hight: %d, Weight: %d, IQ: %d" % (age, hight, weight, iq)
我明白了:
TypeError: %d format: a number is required, not tuple
但是为什么?
【问题讨论】:
-
天哪,对不起,我现在才知道
标签: python python-2.7 typeerror