Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Python by (50.2k points)

I want to know the main difference between "greater than" or "equal", rather than "equal" or "greater than"?

foo = 1

if foo >= 1:

  print("Greater than 1")

>>> Greater than 1

while the following would raise a SyntaxError:

foo = 1

if a => 1:

  print("Greater than 1")

1 Answer

0 votes
by (108k points)

Kindly be informed that this '>=' is one operator, not two. Likewise with <=. As for why the series is the way it is in modern programming languages, the explanation is just 'convention'.

The judgment to make it >=/<= rather than =>/=< is by convention and is popular among almost all existing programming languages that use comparison operators at all. The traditional programming languages that used comparison operators, to my knowledge, are FORTRAN and COBOL, both of which follow the >=/<= convention.

Want to be a Python expert? Join this Python Training course by Intellipaat to learn more.

Browse Categories

...