Rating: 4.0
1 + 1
one + one
nine plus nine
9 plus nine
These are all the possible ways the expression will be asked.
Recieve the line and split it based on the space.
You then get a list where each part of the expression will be in the same spot.
Use the word2number library so that no matter what format the numbers are in (string with spelling or the int
itself) you can use eval on it.
search for "plus" or "minus" and replace it with the sign.
run eval on a string with word2number and the operator, send the result, ignore the line saying it is correct
and do the same when the next is solved.
break from the loop when the flag is in the output