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.
so functions in python are first-class objects -- you're able to set variables equal to them just as with any other object type. lambda is a way to define a function without a name and in this case, the unnamed function takes one argument, n, and we return the expected series. So generateIntegers is now a variable that is equal to the function and generateIntegers(6) would yield the expected value as a consequence of that.
Apologies for the slightly roundabout description but I think I've avoided writing a spoiler, maybe, mostly..
I'm using this language feature in an admittedly gimmicky way (to write one-line solutions to codewars problems) but it is a very helpful language feature (the first-classness of functions) -- many other languages treat functions as different (and don't allow this sort of assignment.)
how do you run this exactly or input the value n in the function? thanks!
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution