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.
But didn't it takes more time for slicing, if there is long list? And what if we check "len(arr) > 2" instead of "len(arr) > 1". Wouldn't it be faster?
i in this case would be the current element of the for loop not the list: for i in fruit_bag
i thought its possible to use "startswith" only with strings and not items in list ....
i'm not good at Python, but I dont understand how this could possibly be a problem. even if you do something like this:
there will be no issues. the only thing i can think of is if the user wants to use something from the string module inside of the function, and forgets to rename the parameter. i've changed it to
strng
just in case.if someone sees a problem please reopen the issue
OP solved it, closing
You shouldn't close the issue before fixing it...
Oh, thank you for this comment. I saw in a lot of solutions this empty char put in front of the string and i was wondering if it is really necessary and if I missed something.
Sorry, i try to fix it
Kind regards
corrected
Don't mutate the input.
reversed(arr)
actuallyreturn
s an iterator,list(reversed(arr))
would create a list copy. Anyway, I thinkarr.reverse()
is the fastest way to reverse alist
https://stackoverflow.com/a/40294928/6260170This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Got it, Example cases had a name string variable. Should work now.
This comment is hidden because it contains spoiler information about the solution
Loading more items...