Week 1
Math Interpreter
Split one line into a number, a sign, and another number, then do that one operation.
A short expression, with spaces.
A number with one decimal place.
The question, more slowly
The question is: one line shaped as a number, a space, an operator, a space, and another number. The operator is add, subtract, multiply, or divide. You print the result with one decimal place. Division will not be by zero.
Split the line into three pieces. The two numbers arrive as text, so convert them. Then choose the operation from the sign in the middle. Formatting to one decimal is a separate step from the arithmetic.
People do integer division and print a whole number, or they forget the space and try to parse 1+1. The spec promises spaces.
Before you code
Do 1 plus 1 and 50 divided by 5 on paper, written with one decimal place, before you code.