At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
You would need to examine the string using some sort of a loop and find all the parenthesis first. This would allow you to build the order of operations into your evaluation system. In fact, working with the order of operations would be the real key. That would let you place things in the list in the order they need to be evaluated to get an answer. Also, your evaluation routine would need to loop or recurs based on if it finds a list within the list.
use a stack..
@A.Avinash_Goutham He posted in the MIT 6.189 area, which is an Intro to Python class. In Python, the list can be used as a stack. With append() and pop() it becomes a LIFO data structure.
Not the answer you are looking for? Search for more explanations.
i got the logic. But the problem is i am not being able to write the proper code.
Well, what did you come up with?
@sidd607 , while not my solution, here's what google brings up -
in other words - there is no simple solution to this as you have to parse numerical strings that can get pretty hairy...
A warm Welcome to OpenStudy. I can help guide you through this useful site. You can ask your questions to me or you can message me. Please use the chat for off topic questions. Remember to give the person who helped you a medal by clicking on "Best Answer". We follow a code of conduct, ( http://openstudy.com/code-of-conduct ). Please take a moment to read it.q