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.
From my point of view, the function could be split into two distinct parts. The first part (the for loop that counts uppercase and lowercase characters) could be moved into a separate function that simply returns those counts. Also, the else case with the pass statement in the loop isn’t necessary and can be removed to simplify the code.
The same applies to the second part of the function. You could eliminate one of the else cases and move the logic into another function as well.
With these improvements, the purpose of the solve function becomes much clearer: it counts the number of uppercase and lowercase characters and then converts the string to either lowercase or uppercase based on that count—without needing to dive into the implementation details.
Actually, after reviewing my own code, I’ve decided to refactor it too. Thanks for the feedback! 😄 I realize I was trying to do too many things at once.
Which part didnt you understand
Code not clear enougth
Great
This comment is hidden because it contains spoiler information about the solution