While reading about strings today, I found out that you can actually compare strings to one another in Python. Not just to check if two strings are equal, but you can actually compare them with < > operators. Alright, in actuality, it just compares the alphabetical order of the two strings but when you don't know that, man, it is weird.
# Let's see if bananas are 'greater than' Zebras or not.
>>> 'banana' < 'Zebra'
False
>>> 'banana' > 'Zebra'
True
No comments:
Post a Comment