Bite 159. Create a simple calculator
Login and get codingIn this Bite you will create a simple calculator. It takes a string of
num1 operator num2which you convert into its calculation returning its result. Completesimple_calculatorto that end supporting+,-,*and/("true" division so 2/3 = .66 rather than 0).So passing
'2 * 3'into the function it would return6,'2 + 6'results in8,'-5 * -11'=55and lastly'1 / 5'=0.20.For any bad data passed into the function (e.g.
a / 3,2 * b,1 ^ 2, etc), you should raise aValueError.Good luck and have fun!
Will you be the 127th person to crack this Bite?
Resolution time: ~24 min. (avg. submissions of 5-240 min.)
Our community rates this Bite 2.57 on a 1-10 difficulty scale.
» You can do it! 😌