+ 1
Calculator for python robot
How could I add a calculator to my python robot with this input x + y (add) x - y (subtract) x * y (multiply) x / y (divide) https://code.sololearn.com/cGBTjfDicqdd/?ref=app
5 Answers
+ 1
Like, you want the user to input "5+5" and detect that's addition and output the answer? If that's the case, use "eval" function, it'll be a good choice
Or if you're trying to advertise your code(cuz it's a very simple thing for a person who coded a communicating Robot), it's strictly prohibited in this forum
+ 1
Rishi ive tried using an eval function but it needs to be set to function by the user input because there are other commands
+ 1
Rishi i would have to write it as if it is an equation than print eval but idk how to do that
+ 1
exonits well in that case I too don't have an idea, I think let's wait for someone with an idea to answer :)
+ 1
Rishi ok