Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why is 'a' greater than 'A' in python?

First I tried this:

    print('a' > 'A')

The above statement returns true

Then I tried this:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

    print('A' > 'a')

The above statement returns false

What is the reason?

>Solution :

According to the ASCII table, value of ‘A’ is 65 and ‘a’ is 97.

So if u compare a single character between a-z,A-Z Python takes it’s ASCII value.

You can check the ASCII table from here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading