你好,我想知道爲什麼我的加法運算的代碼不能正常工作,我是新來的,一般蟒蛇和編程,我使用python 3.4.1.Heres代碼:爲什麼我的簡單蟒添加計算器工作?
def add(x, y):
"""This function will add two numbers"""
return x + y
number1 = int(input("pick a number: "))
number2 = int(input("pick another number: "))
choice = input
choice2 = input
if choice == '1' '2' '3' '4' '5' '6' '7' '8' '9' '10':
print (number1,"+",number2, "=", add(number1,number2))
if choice2 == '1' '2' '3' '4' '5' '6' '7' '8' '9' '10':
print (number1,"+",number2, "=", add(number1,number2))
編輯:感謝你大家的幫助我想出來:)
我在這臺機器上的Python 2.7.6。隨意將'raw_input'改回'input'。 – 2014-08-29 05:05:36
非常感謝你,我得到它的工作:) – jediquest1 2014-08-29 05:24:19