我刚刚开始学习 Python,而且我是一个绝对的新手。
我开始学习函数,我写了这个简单的脚本:
def add(a,b):
return a + b
print "The first number you want to add?"
a = raw_input("First no: ")
print "What's the second number you want to add?"
b = raw_input("Second no: ")
result = add(a, b)
print "The result is: %r." % result
脚本运行正常,但结果不会是总和。即:如果我为'a'输入5,为'b'输入6,结果将不是'11',而是56。如:
The first number you want to add?
First no: 5
What's the second number you want to add?
Second no: 6
The result is: '56'.
任何帮助,将不胜感激。