Calculator help

I’m a bit confused on how to write the operate function, should i write it like the eval() function i.e it should take a string as an argument like:
operate(" 2 + 2 ")
or like:
operate(num1,operator,num2)

Hi friend,

I believe you should use the second option -> operate(num1,operator,num2).

In the third paragraph of the calculator introduction, there is a section labeled “Important Note”. It stated that eval functions are dangerous and shouldn’t be used here. Goodluck!

1 Like

I see, thank you!.