类型错误:%d格式:需要数字,而不是tup

2024-09-29 23:15:28 发布

您现在位置:Python中文网/ 问答频道 /正文

我在运行这个:

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)

我得到了这个:

^{pr2}$

但为什么呢?在


Tags: addagereturndefmultiplyprintsubtractweight

热门问题