Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
what did the google tell you
update: it's an anonymous function -> can be implemented without being assigned to a name
Could someone help explain to me what "lambda" does???
def price(a: int, b: int) -> int:
if a == 0:
t = 0
elif b == 0:
t = 0
else:
a = a + b
b = b - 0
t = a * b - b ** 2
return t
how desperate are you?
"yes"
What you've asked is a good question. I don't have an answer to that. I chose to solve the question as proposed before your answer because it requires a bit more from the coder, in this case, me.
Fair play, that is more elegant. As a question, why allow negative prices or servings?
Yeah, as the guy below said, you are able to write it directly on the return level to get rid of redundant variables that are not used within the method
You don't have to use '()' because multiplication always comes before addition.
You could actually write something like this:
return a * b + 1
Since priority first goes to multiplication.
but you had yourself also created a function...
No need for making it a function 💀
If you want to fork a solution, go to solution panel and pick any of the solutions, but do not fork the translation using the
fork
button if you ONLY want to modify existing solutions of the translation ...I see, thank you for the feedback. I'll stop authoring for now and just focus on learning more.
But when you say that users must use
while
loop, tests have to check this.I think because the while loop directly models the problem's sequential reduction requirement. And I kinda notice most of the kata are solved using for loops so it might be nice if there's a kata that can be solved only using while loops.
Loading more items...