Absolutely brand new to python.
Here is some code from a tutorial that works, I just don't understand why.
Why is the code *not*
Here is some code from a tutorial that works, I just don't understand why.
strs = ['xc', 'zb', 'yd' ,'wa'] def MyFn(s): return s[-1] print(sorted(strs, key=MyFn)) ## ['wa', 'zb', 'xc', 'yd']My question is, why am I not required to pass an argument (s) to MyFn?
Why is the code *not*
print(sorted(strs, key=MyFn(strs)))