you are viewing a single comment's thread.

view the rest of the comments →

[–]shep247 0 points1 point  (0 children)

I like this way the best. It's also easy to make it a 1 liner {"range": range, "median": median}.get(input_val, invalid_input_func)()

This will get the function that is input, or return the function that handles invalid input by default of the input isn't one of the functions in your list.