Step 1

Write a command line program, that accepts dual-operand infix-only mathematical equations and calculates the results, in an endless loop.1

You may assume the user input has the structure: operand 1, space, operator, space, operand 2 like so 1 + 5 or 6 - 8.2

It should at least accept +, -, *, / as operators.3 4 5

Example:

Enter your equation:
2 - 4  
-2

Step 2

Log6 your calculations and their results in a textfile.
Use the following format: 1 + 5 = 6 7

  1. A while loop would be appropriate here. 

  2. Since we assume operands and operator are separated by spaces, we can split the string at the spaces. input.split(' ') 

  3. Remember to cast the operands to an int or even better float, once you have split it. 

  4. Also remember, that you can pack multiple if/else commands:

    if condition1:
        # commands
    elif condition2:
        # commands
    #there is no limit to the number of elifs
    else:
        # normal case
    

  5. Do not forget to catch the ZeroDivisionError Exception! 

  6. You can log it using append mode: open(filename, 'a') 

  7. Do not forget to add a newline at the end of every line,