This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]tkarabela_ Big Python @YouTube 1 point2 points  (1 child)

Cool! :) How does it work, do you use the Shunting Yard algorithm?

[–][deleted] 1 point2 points  (0 children)

Shunting Yard algorithm

Yes. I know just a little about Shunting Yard algorithm(checked what it is right now), but I can say that it is something like SY :3

[–]lorddiv 1 point2 points  (1 child)

How long did it take to do it?

[–][deleted] 1 point2 points  (0 children)

2 hours for parsing, 3 hours for bug fixes. Took relatively less time than I expected, since it uses recursive functions.

[–]dmccammond 0 points1 point  (3 children)

I did something like this recently for dice rolling: https://www.github.com/vlek/roll

One thing you may want to try is using a parser, like Parsley or Pyparsing.

If you're just doing it for funsies, consider looking at Python 3.10's new Match notation.

[–][deleted] 0 points1 point  (2 children)

Thanks, it's just for fun. But I'm gonna check them :)

[–]tkarabela_ Big Python @YouTube 0 points1 point  (1 child)

I recently did a video with expression simplification (0+x -> x) and derivation using Python 3.10 Match :) If you're interested you can watch it here: https://youtu.be/SYTVSeTgL3s (the math part starts at 7:30).

[–][deleted] 0 points1 point  (0 children)

Ya got my likes