Python Basic Tutorials

Python is a high level general purpose programming language which has a clear/easy learning curve. Python programming language is massively used in various domains like Artificial Intelligence, Data Science, Web Development, Utilities Tools and Scripts and many more

Python is a Programming language, and the default Python we use is written in C programming language which is also referred to as CPython (Python implementation in C). There are various implementation of Python Programming language i.e Jython(in JAVA), Skulpt(in JS) e.t.c

To make everything easy: We refer CPython as Python

Python Logical Operator

Operators which are used to perform logical operations like and, or, not are called logical operators. Example: and, or, not.

Operators Operator meanings Examples
and True if both operands are True otherwise False. >>>True and False
False
or True if only one operand is True. >>>True or False
True
not True if Operand is False and vice-versa. >>>not False
True
>=(Greater than or equal to) True if the left operand is greater than or equal to the right. >>>5>=4
True
<=(Less than or equal to) True if the left operand is less than or equal to the right. >>>6<=6
True
!=(Not equal to) True if operands are not equal. >>>5!=5
False
Examples
    
>>>True and False
   False

>>>True or False
   True

>>>not False
   True

>>>not True
   False

>>> [] or [1]  # empty list or non empty list
    True
>>> [] and [1] # empty list and non empty list
    False
>>> "" and "abc" # empty string and non empty string
    False