Hello great people of Codecademy,
Can you please help me this this error I’m getting on this very basic Calculator program, for some reason, out of the 4 methods I created, somehow ‘addition’ throws an error, all others work.
Here is the code:
calcmethod = input("What would you like to do today - Type add, sub, multi or divi:")
first_entry = int(input("Type your first entry:" ))
second_entry = int(input("Type your second entry:" ))
class Calculator:
def __init__(self, n1, n2):
self.numberone = n1
self.numbertwo = n2
@classmethod
def addition(self):
s = self.numberone+self.numbertwo
print(s)
def subtraction(self):
s = self.numberone-self.numbertwo
print(s)
def multiplication(self):
s = self.numberone*self.numbertwo
print(s)
def division(self):
s = self.numberone/self.numbertwo
print(s)
perform = Calculator(first_entry,second_entry)
if calcmethod == "add":
perform.addition()
if calcmethod == "sub":
perform.subtraction()
if calcmethod == "multi":
perform.multiplication()
if calcmethod == "divi":
perform.division()
AND here is the error: