Jan-26-2018, 11:13 PM
I don't understand your objection. One can ask the user to input 3 different probabilities by calling
Consider the following example
proba_input()
3 timesfor i in range(3): qux = proba_input('Give me the {}-th probability: '.format(i))The line with partial is only a way to define a new callable (
proba_input
) by specifying two arguments for typed_input
.Consider the following example
>>> def is_multiple_of(a, b): ... return b % a == 0 ... >>> is_multiple_of(5, 15) True >>> is_multiple_of(5, 14) False >>> from functools import partial >>> is_even = partial(is_multiple_of, 2) >>> is_even(14) True >>> is_even(13) False >>> is_even(12) True >>> is_even(9) False