Login Register


Silver Challenge (2) Simple Equation Parser filter_list
Author
Message
RE: Challenge (2) Simple Equation Parser #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. Wink2 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. Wink
(This post was last modified: 12-21-2015, 06:13 AM by m0dem.)

Reply





Messages In This Thread
Challenge (2) Simple Equation Parser - by m0dem - 12-19-2015, 11:04 PM
RE: Challenge (2) Simple Equation Parser - by m0dem - 12-21-2015, 06:01 AM



Users browsing this thread: 1 Guest(s)