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.
Smarty pants :)
The sum function adds all of the elements in the list.
The input list is a list of 1's for every letter in the sentece if that letter is a vowel.
Therefore we sum all of those 1's together to get the number of vowels.
For example is inputStr is "abcdeabcde", then the list input into the sum function would be
[1, 1,1, 1]
So by summing it up we get sum([1,1,1,1]) = 1+1+1+1 = 4 vowels.
def idontunderstand:
return shame
Yep, no need in str(value) and len(str(value)) every iteration. Unnecessary operations.
So much cleaner code
This comment is hidden because it contains spoiler information about the solution
why is that?
Sadly in Python using string functions is sometimes more performant than calculating these values.
From my point of view (I'm someone who is just starting to learn Python), the most important thing when designing a function wouldn't be efficiency, the time it takes to execute, right? Whenever I manage to solve a function, I compare it with others using the timeit module, and if one runs faster than another, it's better. Many times, I find that some written in just one line are not the most efficient.
good job
fast and practical
wow
cool. really cool.
YASSSS QUEEN!!!
This comment is hidden because it contains spoiler information about the solution
Loading more items...