Here's another way to do this:
class Calculator: def __init__(self): self.form = { 'header': ["simple calculator by Solstice", "I-----I", "I00000I", "I-----I", "I1 2 3I", "I4 5 6I", "I7 8 9I", "I-----I", "", "when the program asks for +- x : type restart to make some space"] } self.calc() def print_header(self): for line in self.form['header']: print(line) def add(self): x = input("first number ") y = input("number to add ") return int(x) + int(y) def subtract(self): x = input("first number ") y = input("minus which number? ") return int(x) - int(y) def multiply(self): x = input("first number ") y = input("times what? ") return int(x) * int(y) def divide(self): x = input("first number ") y = input("divided by which number? ") return int(x) / int(y) def restart(self): print('\n' * 14) print("===========================================================") print("I New calculation I") print("===========================================================") def calc(self): self.print_header() while True: c = input("+/-/x//? ") if c == "+": print(self.add()) elif c == "-": print(self.subtract()) elif c == "x": print(self.multiply()) elif c == "//": print(self.divide()) elif c == "restart": self.restart() input("results(Enter to continue)") if __name__ == '__main__': Calculator()