+ 1
Is there a way to parse a list to combine 2 elements into 1?
right now, am parsing a string into a list i.e., str = (12*2)+(200/25) list =['(' ,'1', '2', ')', '+', '(', '2', '0'. '0', '/', '2', '5', ')'] ok, so what I would like to do is combine the numbers so that i can turn them in to integers, the pull it all back down into a calculable problem. HELP!!! lol here is my code: https://code.sololearn.com/cS4eTs09kwCQ/#py
4 ответов
+ 4
I think you can use eval for your program's purpose: https://docs.python.org/3/library/functions.html#eval
+ 2
thanks man, much appreciated.
+ 2
thanks man, that fixed it
https://code.sololearn.com/cS4eTs09kwCQ/?ref=app
+ 2
You're welcome.