我剛剛在python中編寫了一個簡單的計算器腳本,通常Python應該默認識別( - )減號,(*)乘法,(/)除號,但在考慮這個腳本時,它無法識別跡象。請留下您的意見,以清除我...python中的基本計算器程序
#! /usr/bin/python
print("1: ADDITION")
print("2: SUBTRACTION")
print("3: MULTIPLICATION")
print("4: DIVISION")
CHOICE = raw_input("Enter the Numbers:")
if CHOICE == "1":
a = raw_input("Enter the value of a:")
b = raw_input("Enter the value of b:")
c = a + b
print c
elif CHOICE == "2":
a = raw_input("Enter the value of a:")
b = raw_input("Enter the value of b:")
c = a - b
print c
elif CHOICE == "3":
a = raw_input("Enter the value of a:")
b = raw_input("Enter the value of b:")
c = a * b
print c
elif CHOICE == "4":
a = raw_input("Enter the value of a:")
b = raw_input("Enter the value of b:")
c = a/b
print c
else:
print "Invalid Number"
print "\n"
我不明白這個問題。你不處理這個腳本中的符號,你處理數字。 (雖然與a和b的類型有關的單獨問題。) –
順便說一句,它是'division'。 –