#calculator project
#class -> init -> method/attribute -> funct vs method
class Clac(object):
#init metedu
def __init__(self,a,b):
"initialalize values"
#attribute
self.value1=a
self.value2=b
pass
def add(self):
"addition a+b = result -> retur result"
return self.value1 + self.value2
def multiply(self):
"multiplication a*b = result -> return result"
return self.value1 * self.value2
print("Choose add(1) , multiply(2)")
selection = input("select 1 or 2\n")
v1 = int(input("First value = "))
v2 = int(input("Second value = "))
c1 = Clac(v1,v2)
if selection == "1":
add_result = c1.add()
print("Add: {}".format(add_result))
elif selection == "2":
multiply_result = c1.multiply()
print("Multiply: {}".format( multiply_result))En alttaki if'ten sonra kodum hata veriyor. Yardımcı olabilecek var mı?
Hata kodu bu: IndentationError: unindent does not match any outer indentation level
Hocam boşluklarda sorun var. Bazen olmamasına rağmen hata verir. bu yüzden yeni bir dosyaya kopyalayın tüm dosyayı ve boşluklarınız kontrol edin.