It is possible to define a function into another function but is pointless in your case. Rid of all these math functions which are doing one thing, to return a calculation result of two values. There is no indentation of elif to if
For now, that's all.
All in all, I'd have a different approach to almost everything.
if(operation == '+'): return num1 + num2 elif(operation == '-'): return num1 - num2 elif(operation == '*'): return num1 * num2 else: return num1 / num2 ...... print(calculator())Also, you call calculator() inside its own code. Use while loop instead.
For now, that's all.
All in all, I'd have a different approach to almost everything.