Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
challenge 2 | test challenge
test daily challenge
course content

Course Content

test daily challenge

test daily challenge

book
challenge 2

Implement a function that evaluates mathematical expressions given as strings. The expressions will contain positive integers and the operators '+', '-', '*', '/', '(', and ')'. Your function should correctly handle operator precedence and parentheses, and return the result as an integer.

You need to write the code that evaluates such expressions and outputs the correct result for each expression provided.

Examples:

Input

Output

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 2
toggle bottom row

book
challenge 2

Implement a function that evaluates mathematical expressions given as strings. The expressions will contain positive integers and the operators '+', '-', '*', '/', '(', and ')'. Your function should correctly handle operator precedence and parentheses, and return the result as an integer.

You need to write the code that evaluates such expressions and outputs the correct result for each expression provided.

Examples:

Input

Output

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 2
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
We're sorry to hear that something went wrong. What happened?
some-alt