I am fairly new to python programming. I have gone through many python calculator codes online and was wondering if there is a way to include as many python inbuilt arithmetic operations as possible without any external libraries with the code as short as possible.
Needed for a small implementation in my project. Thanks!!!
eg.
Input: 5 / 2
output: 2.5
Input: 5 // 2
output: 2
Input: 5 ** 2
Output: 25
etc...
This is the shortest and worst possible python calculator code I can think of:
def worst_calculator_ever(input):
return eval(input)
NOTE: your input should always be a string