![]() Side Note: A Short Intro to the “ Python interpreter“ If you are already familiar with the interpreter, how to launch and use it, you can safely skip this side-note! Here is a short intro to the Python Interpreter for complete beginners. Hence don’t worry if you have an ‘incomplete’ sort of feeling after reading the cheatsheet above, as this article has been handcrafted to take you through the journey of learning from beginner to pro in just about 15-20 minutes and the cheatsheet above is just to get your feet wet! I have divided this article into 3 levels as shown below. Intrigued by the idea of calling one string “greater than” another? Read on! I promise you will learn a thing or 2 as we have merely scratched the surface! The 2 objects under comparison are not just limited to numbers, it can be strings or lists or even some special user-defined classes. ![]() In line-7 we ask “is 4 greater than or equal to 4?” and Python says True as number on either side of the “>=” operator are equal in this case.In line-4 we ask “is 2 greater than 4?”, and Python says False.In line-1 we ask “is 5 greater than 3?”, and Python says True.In other words, the “>=” operator returns False if the 1st object is less than the 2nd object, returns True otherwise.Īn example is worth 1000 words, so here is one for you! > 5 > 3 The ‘>=’ operator, pronounced as “greater than or equal to”, is used to compare 2 objects and returns True if the 1st object is greater than the 2nd object or if the 1st object is equal to the 2nd object and returns False otherwise. The ‘>’ operator, pronounced as “greater than”, is used to compare 2 objects and returns True if the 1st object is greater than the 2nd object and returns False otherwise Is x either greater than y or equal to y?Ĭheatsheet: Python’s “>” and “>=” Operators To see if 1st object is greater than or equal to the 2nd object To see if 1st object is greater than the 2nd object The phrase “Practice Makes Perfect” did not survive so many centuries for no reason!įor those of you who came here just to refresh your memories, here is a cheatsheet! Python’s “>” and “>=” Operators: CheatSheet Operator So put on your coding hats, open your laptops and start experimenting and playing with the code shown in the examples as you read them! The best trick to make our brains remember stuff is via active learning. Python is no exception to this rule!Įven though the concepts might look simple, our brains are really good at understanding the concepts but not so good at remembering them! The first step in the journey towards mastery of any programming language is to learn about the various operators provided by that language and learn how to wield them. In this article let us learn about the “>” and “>=” operators in Python with the help of some examples and learn how to make use of this operator the same way the pros do!
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |