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 trial

Python Python Basics Functions and Looping Functions

Shashank N
Shashank N
655 Points

Why is "a" > "A" true ?

I know they are not equal but how are they compared?

2 Answers

Tsenko Aleksiev
Tsenko Aleksiev
3,819 Points

I don’t know nothing about python but I assume that acording to the ASCI table ( look it in google ), A and a have different codes and that’s why they are different. Now the one is less than the other because int the same table the one is further than the other :)

Tsenko is right. When it comes down to whatever source the language is using it has to interpret the character's value from somewhere.

The easiest way that I think about it is binary since that is close to universal.

01000001 = A = 65 01100001 = a = 97

All told there are 32 characters between A and a, and since the lower case is after the upper case, it just has a higher numeric value

Moderator Edit: Changed from Comment to Answer