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.
Lol. I did same thing
return True if cnt == 0 else False
is an anti-pattern. Should just be
return cnt == 0
Last if statement can be part of elif block --> only validate if you have subtracted
The dificulties could differ from one to the other language
I'm delighted with myself that I've finally written the same function as best practice example!
But the Kata was too easy for 5kyu. Feels like 7kyu
I'm sure, it's best practice, cause it's easy to read and it doesn't use bad practices, like an example above.
It is better to write
return False
thanbreak
.Ha! Seeing this it's suddenly so simple, I went on a bit of a diversion, oops!
not an issue, your approach is just wrong.
Yep! Thats what I did. I do like the current top one more, but yaknow, it works.
Use break will be better in the last line
i indicates an iteration in this case as well.
for i in string:
This is exactly what an iteration is. You iterate over an iterable. In this case that iterable is a string.
good work!
the use of "i" as a variable here might be troublesome -- it's not wrong necessarily, but in most cases, "i" is used in Python to indicate an iteration or count, as in the example:
for i, item in enumerate(some_iterable)
This comment is hidden because it contains spoiler information about the solution