print("Welcome to calculator.py")
print ("your options are :")
print ("")
print ("1) Addition")
print ("2)Subtraction")
print ("3) Multiplication")
print ("4)Division")
print ("Choose your option")
#this adds 2 numbers given
def add (a,b):
print(a, "+" ,b, "=" ,a+b)
#this subtracts 2 numbers given
def sub (a,b):
print(a, "-" ,b, "=" ,b-a)
#this multiplies 2 numbers given
def mul(a,b):
print(a, "*" ,b, "=" ,a*b)
#this divides 2 numbers given
def div(a,b):
def div(a, "/" ,b, "=" ,a/b)
#NOW THE PROGRAM REALLY STARTS ,AS CODE IS RUN
loop = 1
choice = 0
while loop == 1:
choice = menu()
if choice == 1:
add (input("Add this: "),input ("to this: "))
elif choice == 2:
sub(input("Subtract this: "),input ("from this: "))
elif choice == 3:
mul (input("Multiply this: "),input ("by this: "))
elif choice == 4:
div(input("Divide this: "),input ("by this: "))
elif choice ==5:
loop = 0
print ("Thank you for using calculator.py")
これは私のコードであり、エラーがある: プリント( "+"、B "="、A + B) ^ IndentationErrorは:インデントブロックこのインデントエラーは何ですか?
プロセスが出口を終了予想コード1 と多くの人が誰も私がすべてのエラーを見つけるのを助けることができますか? 誰でも私を助けることができますか?
あなたは 'def():'の後にインデントする必要があります。コロン ':')、あなたはいくつかの場所でインデントを解除する必要があります –