File "first.py", line 37
elif(operation == "quadratic formula")
IndentationError: unindent does not match any outer indentation level
私のコードで何が問題なのか本当にわかりません。誰かが助けてくれますか?IndentationError:インデントが外側のインデントレベルと一致しません
def add(var1, var2):
return var1 + var2
def sub(num1, num2):
return num1 - num2
def div(num1, num2):
return num1/num2
def mul(num1,num2):
return num1*num2
def equation1():
import math
a = int(raw_input("please enter your a in the equation: "))
b = int(raw_input("please enter your b in the equation: "))
c = int(raw_input("please enter your c in the equation: "))
d = b**2-4*a*c
if(d < 0):
print "This equation has no real solution"
elif(d == 0):
x = (-b+math.sqrt(b**2-4*a*c))/(2*a)
print "This equation has one solutions: ", x
else:
x1 = (-b+math.sqrt(b**2-4*a*c))/(2*a)
x2 = (-b-math.sqrt(b**2-4*a*c))/(2*a)
print "This equation has two solutions"
print "The first soluition: ", x1
print "And the second solution", x2
def main():
operation = raw_input("what do you want to do (+,-,/,*) or quadratic
formula? ")
if(operation != '+' and operation != '-' and operation != '/' and operation != '*' and operation != 'quadratic formula'):
print 'You must put a valid operation'
elif(operation == "quadratic formula"):
equation1()
else:
var1 = int(raw_input("enter the first number: "))
var2 = int(raw_input("enter the second number: "))
if(operation == '+'):
print (add(var1, var2))
elif(operation == '/'):
print (div(var1, var2))
elif(operation == '-'):
print (sub(var1, var2))
タブとスペースの混合を停止します。また、Cはこれとは何の関係もありません。 – user2357112