Basic python calculator I have a young friend of mine who is starting to learn Python in school and asked me to give him a little assignment. I am in no way a teacher nor a Python expert, but I accepted.
At first I thought it would be fun to start with a bit of parsing for the operation's input, like:
Enter your operation : 3+3

But it seemed a bit overwhelming for him so we agreed to separate it in three parts (first number, operand and second number).
I did a little correction but I find it clumsy and the point of the exercise is to show him some good practices.
So here is my code:
calculate = True
while calculate:
    try:
        number1 = float(input(&quot;Enter the first number : &quot;))
    except ValueError:
            print(&quot;Incorrect value&quot;)
            exit()
    symbol = input(&quot;Enter the operation symbol (+,-,/,*,%) : &quot;)
    try:
        number2 = float(input(&quot;Enter the second number : &quot;))
    except ValueError:
            print(&quot;Incorrect value&quot;)
            exit()
    operande = [&quot;+&quot;, &quot;-&quot;, &quot;*&quot;, &quot;/&quot;, &quot;%&quot;]
    resSentence = &quot;Result of operation \&quot;{} {} {}\&quot; is :&quot;.format(number1, symbol, number2)
    if symbol not in operande:
        print(&quot;Incorrect symbol&quot;)
    elif symbol == &quot;+&quot;:
        print(resSentence, number1 + number2)
    elif symbol == &quot;-&quot;:
        print(resSentence, number1 - number2)
    elif symbol == &quot;*&quot;:
        print(resSentence, number1 * number2)
    elif symbol == &quot;/&quot;:
        print(resSentence, number1 / number2)
    elif symbol == &quot;%&quot;:
        print(resSentence, number1 % number2)
    restart = input(&quot;Do you want to do another calcul (Y/n) ? &quot;)
    while restart.lower() != &quot;y&quot; and restart.lower() != &quot;n&quot;:
        print(restart.lower(), restart.lower(), restart.lower()==&quot;n&quot;)
        restart = input(&quot;Please, enter \&quot;y\&quot; to continue or \&quot;n\&quot; to exit the program : &quot;)
    if restart.lower() == &quot;n&quot;:
        calculate = False

I would have wanted to do a loop when number1 or number2 is not a valid float until the user enter a valid value, but I did not found a clean way to do it. I would gladly accept advices about this (even though I know this is not a question for this Stack Exchange, a good Pythonic way for doing this would be cool :) ).
Use more functions
You have a function calculate(), but if you see it does much more than just calculate, this makes your code look unreasonably clunky. But there is a very simply solution, use more functions. What if your main-loop could look like
while True:
    number1,number2,operand = take_input()
    result = calculate(number1,number2,operand)
    print(f&quot;Answer : {numebr1} {operand} {number2} = {result}&quot;)
    if input(&quot;Do you want to play again? (y/n): &quot;).lower() == 'n':
        break 

This makes it easier to maintain your program.
continue when there is an error
try:
    number1 = float(input(&quot;Enter the first number : &quot;))
except ValueError:
        print(&quot;Incorrect value&quot;)
        exit()

Ask yourself, why would a program terminate if the user enters invalid input? Give him a another chance xD
Maintain consistent indentation
try:
    number2 = float(input(&quot;Enter the second number : &quot;))
except ValueError:
            print(&quot;Incorrect value&quot;)
            exit()

Try to maintain consistent indentation, since you have used 4 spaces earlier, there is no good reason to use 8 later, it might just confuse people who read the code later.
Code logic 1
Let's consider this sample input
Enter the first number : 1
Enter the operation symbol (+,-,/,*,%) : I like python
Enter the second number : 2
Incorrect symbol

Clearly, the symbol is wrong. Why did I have to enter the second number, just to find out I made a mistake while entering the symbol? It should've told me right away that my symbol was incorrect, so I could've corrected it.
Just move the if symbol not in operands statement so it sits right next to the input.
eval
Eval in Python 
This would be the biggest improvement in your program, since it converts about 10-15 lines of code, into one.

The eval() function evaluates the specified expression, if the
expression is a legal Python statement, it will be executed.

That sounds familiar, aren't we basically evaluating simple expressions?
Using eval, your calculation part would look like
result = eval(f&quot;{number1}{operand}{number2}&quot;)

Example, number1 = 5,number2 = 10, operand = '+'
This is what is basically happening
result = eval(&quot;5+10&quot;)

Final
Here is the code with the improvements
def take_input():
    err_msg = &quot;Invalid input&quot;
    operands = ['+','-','*','/','%']
    try:
        num1 = float(input(&quot;Enter number 1: &quot;))
    except Exception:
        print(err_msg)
        return take_input()
    try:
        num2 = float(input(&quot;Enter number 2: &quot;))
    except Exception:
        print(err_msg)
        return take_input()

    print(&quot;Operands: &quot; + ', '.join(x for x in operands))
    try:
        operand = input(&quot;Enter operand: &quot;)
    except Exception:
        print(err_msg)
        return take_input()

    if operand not in operands:
        print(err_msg)
        return take_input()

    return num1,num2,operand

def calculate(num1,num2,operand):
    return eval(f&quot;{num1}{operand}{num2}&quot;)


def mainloop():
    while True:
        num1,num2,operand = take_input()
        result = calculate(num1,num2,operand)
        print(f&quot;Answer: {result}&quot;)
        if input(&quot;Do you want to play again? (y/n): &quot;).lower() == 'n':
            break

mainloop()