0
Can you guys help me to find the bags
class Calculator: def__init__(self): print("Welcome to a calculator") def add(self, a, b): return a + b def sub(self, a, b): return a - b def mul(self, a, b): return a * b def div(self, a, b): return a / b cal = Calculator() a = int(input("Enter the first number: ")) c = input("Choose one of these (+, -, *, /): ") b = int(input("Enter the second number: ")) if c == "+": answer = cal.add(a, b) elif c == "-": answer = cal.sub(a, b) elif c == "*": answer = cal.mul(a, b) elif c == "/": answer = cal.div(a, b) print (f"{a}{c}{b}={answer}")
1 Antwort
+ 3
You're missing a space in line 2.
def __init__(self):