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 trialDextane Rimmer
1,873 PointsI chose true for this question, because 'l' comes before 'z'. Could I get an explanation as to why that answer is wrong?
I got this message " Bummer! When comparing strings, the first letter of the first string is compared to the first letter of the second string. Since 'l' comes before 'z' in the alphabet, 'lion' is not greater than 'zebra.'"
Which doesn't agree with me in practice, but agrees with me in theory. I'm pretty confused, can anyone tell me what I'm missing here?
2 Answers
rydavim
18,814 PointsThis isn't exactly what's happening, but maybe you could think of it in terms of "numeric" values for numbers?
// (12 > 26) (l > z) = False
( 'lion' > 'zebra' )
Emmanuel C
10,636 PointsIf you were to number the alphabet, where a = 1 , b=2, c=3.... z = 26.
The letter "l" would be 12 and z is 26. 12 is < 26. Thats why lion would be less than zebra. It takes the first letter of each string and compares them like that.
Dextane Rimmer
1,873 PointsThank you, I understand what I was missing, now!