Last active
September 1, 2018 19:00
-
-
Save pknowledge/842f5cc5a2409297e4668c01283403c2 to your computer and use it in GitHub Desktop.
Boolean, Comparison Operators and Logical Operators in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python Tutorial for Beginners 10 - Boolean, Comparison Operators and Logical Operators in Python | |
https://www.youtube.com/watch?v=0MBLkNlffT0 | |
>>> True | |
True | |
>>> False | |
False | |
>>> true | |
Traceback (most recent call last): | |
File "<input>", line 1, in <module> | |
NameError: name 'true' is not defined | |
>>> false | |
Traceback (most recent call last): | |
File "<input>", line 1, in <module> | |
NameError: name 'false' is not defined | |
>>> 10 > 9 | |
True | |
>>> 10 < 9 | |
False | |
>>> 100 == 100 | |
True | |
>>> 100 == 99 | |
False | |
>>> 100 != 99 | |
True | |
>>> x = 20 | |
>>> y = 30 | |
>>> x >= y | |
False | |
>>> x = 30 | |
>>> x <= y | |
True | |
>>> 'hello' == "hello" | |
True | |
>>> 'hello'.isupper() | |
False | |
>>> 'hello'.islower() | |
True | |
>>> 'hello'.isalpha() | |
True | |
>>> 'hello'.isalnum() | |
True | |
>>> 10 > 9 and 20 < 15 | |
False | |
>>> 10 > 9 or 20 < 15 | |
True | |
>>> 10 > 9 or 20 > 15 | |
True | |
>>> not 10 > 9 | |
False | |
>>> not 10 < 9 | |
True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment