f = open("calculator.txt", "a+")
a = True
while a == True:
    operation = input("Please input an operation (+, -, *, /): ")
    num1 = float(input("Please input number 1: "))
    num2 = float(input("Please input number 2: "))
    if operation == "+":
       result = num1 + num2
    elif operation == "-":
        print(num1 - num2)
    elif operation == "*":
        print(num1 * num2)
    elif operation == "/":
        print(num1 / num2)
    answer = input("Run again? (Yes/No): ")
    if answer == "Yes":
        continue
    else:
        print("Goodbye ")
    exit()
How do i go about writing the results of the calculations in a file? Say the user inputs 5 + 5 and the program returns 10, how would I save "10" in a text file? If possible the entire equation "5+5 = 10"
 
     
     
     
     
     
    