RE: Challenge (2) Simple Equation Parser 12-21-2015, 06:01 AM
#3
(12-20-2015, 03:50 AM)Nevermore Wrote: Onelined it. (accepts string or list, if the input was already tokenized)
Code:def parse(s): return '' if len(s)!=3 else {str(s[1]): [int(s[0]),int(s[2])]}
I think it'd be better to these challenges in the coding subforum, rather than python, so people fluent in other programming languages can solve them without being off-topic
Eww... I hate one-liners.
Nice code.I should put these in the main coding subforum... I actually first started to create it there, but then I changed to the Python section for some reason.
This challenge (not) sucks... it's MUCH too easy, I must formulate a more advanced version...
@'Nevermore', I updated the post with a more advanced challenge.
(This post was last modified: 12-21-2015, 06:13 AM by m0dem.)





![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)