logical operators in python
condition1 and condition2
condition1 or condition2
not condition
logical operators in python
condition1 and condition2
condition1 or condition2
not condition
!= python
#The (!) is the not operator in Python, (!=) means not equal to.
if 2!=10:
print("2 isn't equal to 10.")
elif 2=10:
print("2 is equal to 10.")
#Prints "2 isn't equal to 10." as 2 isn't equal to 10. Is it?
python >>
# >> and << are bitwise operators. They shift the bits of an integer right and left
# 7 = 0111
print(7 >> 1)
# 3 (0011)
print(7 << 1)
# 14 (1110)
python << >>
#PYTHON BITWISE OPERATORS
OPERATOR DESCRIPTION SYNTAX FUNCTION IN-PLACE METHOD
& Bitwise AND a & b and_(a, b) __and__(self, other)
| Bitwise OR a | b or_(a,b) __or__(self, other)
^ Bitwise XOR a ^ b xor(a, b) __xor__(self, other)
~ Bitwise NOT ~ a invert(a) __invert__(self)
>> Bitwise R shift a >> b rshift(a, b) __irshift__(self, other)
<< Bitwise L shift a << b lshift(a, b) __lshift__(self, other)
python <>
a = 1
b = 2
if a != b:
print("Dunno")
if a <> b:
print("Dunno")
above mentioned code are same As described in the documentation,
they are the same. <> is deprecated and was removed in Python 3,
so you should use !=
https://docs.python.org/2/reference/expressions.html#not-in
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us