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.
This one is concise and well-understandable, respect!
The explanations I have seen suggest that for short lists sorting and slicing can be faster but sorted() starts to chug on big lists, so min() max() is better practice when you don't know how big the list is going to be.
That's what I did
@eijni Thanks about the tip. I was not sure if you had to tag as a spoiler for comments also :) I'm new to this discuss board.
??????
please use spoiler flag when writing comments that may reveal solution since it's visible in discourse ~~
This comment is hidden because it contains spoiler information about the solution
It very clearly does, otherwise the tests would fail.
This doesnt even work!
format()
wins with concatenation where more than 2+
are used. So this one stands on border.It's because concatenation constantly creates new string objects which are immediately discarded and this at some point is outperformed by
str.format
parsing.Explaination (simplified).
'a' + 'b' + 'c'
execution order is: create'a'
, create'b'
, concatenate to'ab'
, discard'a'
and'b'
, create'c'
, concatenate to'abc'
, discard'ab'
and'c'
. Your performance is lost on byproducts like'ab'
.This is because in Python 3.X
map
returns an iterator instead a list. In general iterators in Python are "empty" after first runthrough thusmin(n)
tries to run on empty iterator (emptied bymax
) and throws an error.Solution: use
list(map(...))
.