Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRobert Rydlewski
3,828 PointsCan someone explain me logic behind it ??
How the logic works here ? Does it account only first letter of the string ?? So for example letter A have more points then letter B etc.. ??
I forget how this work. So for example abc > abd. ??? how this works ?
2 Answers
frankgenova
Python Web Development Techdegree Student 15,616 PointsPython will sort strings alphabetically in ascending order. Capital letters come before lower case letters. The way to represent this logic is that a string that sorts before another string is less than or lower than the subsequent string. Imagine that the letters have values that correspond to their alphabetical order (with a set of Capital letters followed by lower case letters. This would start with A=1, B=2 ... Z=26 and then continue with a=27, b=28 ... z=52. In this way A<a and Z<a and b>a and b>Z.
Robert Rydlewski
3,828 PointsThank You so much !!!!