Learn Python Programming: A Step-by-Step Guide about How to Program and Understand Python Programming, Practical Exercises to Apply Theory, Tips and Tricks to Learn Faster Computer Programming by Moore Richard & Moore Richard

Learn Python Programming: A Step-by-Step Guide about How to Program and Understand Python Programming, Practical Exercises to Apply Theory, Tips and Tricks to Learn Faster Computer Programming by Moore Richard & Moore Richard

Author:Moore, Richard & Moore, Richard [Moore, Richard]
Language: eng
Format: epub
Published: 2019-10-06T00:00:00+00:00


Less than or equal: <=

Greater than: >

Greater than or equal: >=

Equal: =

Not equal: !=

These operators are used to perform a data check. Keep in mind that you can even write the same conditional statements using different operators, just by changing some values. However, you should be aware that the statements will yield a positive or a negative result. Here’s a set of basic examples:

6 < 9

True

-11 >=10

False

5.5 != 5.5

False

21.766 > 65.2

False

Quite straightforward, isn’t it? Next, let’s see a simple conditional expression. We will only assign a value to a variable and then perform a comparison:

x = 10

x == 10

True

You will notice that the two statements are very similar, however, they are extremely different in fact. When you use a single assignment operator, it means you are assigning a value to the variable. In this case, we determine that x is equal to 10. Next, we use two equal signs which means that we are comparing two values. In this case, we check whether the value of x is indeed equal to 1o. Since x is 10, the comparison turns a true value. Take note that if you confuse the two operators Python is kind enough to let you know by throwing a syntax error.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.