Hi, kgashok
The way you name the keyword arguments might kind of confuse the reader,
since conventionlly we name keyword arguments using the word 'kwargs' in
order to avoid confusion with 'args', which is actually short for '(positional) arguments'.
Thanks a lot for your generic solution, which is really really impressive.
I learned a lot from it. And for the sake of my understanding, I added some comments to your source code.
that won't be more generic since the 3 comes from the number of arguments. ;p
And if you make it more genrice with any number of values, this will become especially inefficient because of index.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Hi, kgashok
The way you name the keyword arguments might kind of confuse the reader,
since conventionlly we name keyword arguments using the word 'kwargs' in
order to avoid confusion with 'args', which is actually short for '(positional) arguments'.
For more information on how to name parameters with the ** sign, see:
http://book.pythontips.com/en/latest/args_and_kwargs.html
Thanks a lot for your generic solution, which is really really impressive.
I learned a lot from it. And for the sake of my understanding, I added some comments to your source code.
yes, that's it. For instance, here is what it could look like, having a generic solution.
Thank you for your reply.
Are you sure that '3' comes from the number of arguments?
Well, I think you might've meant the number of parameters except 'x', which is also the length of
the list containing a, b, c, etc., right?
And I should've said, "Before replacing '3' with 'len(l)', you have to manually type in as many parameters as you want."
that won't be more generic since the 3 comes from the number of arguments. ;p
And if you make it more genrice with any number of values, this will become especially inefficient because of
index
.Very impressive!
You also inspired me!
To make it more generic, we can replace '3' with len(l).
A clever solution.
This solution would be much better if the .keys() part could be left off,
since calling the dict.keys() method is unnecessary.
if merch not in stock, which could do the same thing as if merch not in stock.keys()
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution