Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Course on Internet of Things Exercises Session 1: | ||||||||
Line: 42 to 42 | ||||||||
Bonus points: Writing a parser for user input is rather easy if the numbers and operator are separated by spaces (have a look at the split method of strings). It is quite a bit more tricky if you allow entering calculations without spaces between the operands and the operator. Can you write a parser accomplishing this? | ||||||||
Added: | ||||||||
> > | Hint: A very elegant solution to this is the use of regular expressions and Python provides a module helping you with this: https://docs.micropython.org/en/latest/library/ure.html | |||||||
Try your parser on this input:
| ||||||||
Line: 52 to 56 | ||||||||
| ||||||||
Added: | ||||||||
> > |
| |||||||
Try also several spaces in between operands and operator. https://afnog.iotworkshop.africa/pub/IoT_Course_English/REPLAndStandardPythonProgramming/calculatorV3.py.txt |