python operators cheat sheet

#PYTHON RELATIONAL OPERATORS
OPERATOR    DESCRIPTION	        SYNTAX  FUNCTION        IN-PLACE METHOD
>	        Greater than	    a > b   gt(a, b)        __gt__(self, other)
>=	        Greater or equal to	a >= b  ge(a, b)        __ge__(self, other)
<	        Less than	        a < b   lt(a, b)        __lt__(self, other)
<=	        Less or equal to	a <= b  le(a, b)        __le__(self, other)
==	        Equal to	        a == b  eq(a, b)        __eq__(self, other)
!=	        Not equal to        a != b  ne(a, b)        __ne__(self, other)

#PYTHON MATHEMATICAL OPERATORS
OPERATOR	DESCRIPTION	        SYNTAX  FUNCTION        IN-PLACE METHOD
+	        Addition	        a + b   add(a, b)       __add__(self, other)
–	        Subtraction	        a - b   sub(a, b)       __sub__(self, other)
*	        Multiplication	    a * b   mul(a, b)       __mul__(self, other)
/	        True Division	    a / b   truediv(a, b)   __truediv__(self, other)
//	        Floor Division	    a // b  floordiv(a, b)  __floordiv__(self, other)
%	        Modulo	            a % b   mod(a, b)       __mod__(self, other)
**	        Power	            a ** b  pow(a, b)       __pow__(self, other)

#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)

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
&amp; python operator // python operator meaning &gt;= operator python python % operators //= operator python python operators module python operators in string ^= python operator basic python operator information python ' ' operator use operator in python - Use and, or operators python uses of The &ldquo;*&rdquo; operator in python 3 ** python operator python /operator python operators . python operator '%' python operators &amp; not code |= operator i python == operator python python 3 operators python '^' operator %operator in python python != operator &lt;&gt; operator in python + operators in python python operator | .operator in python -&gt; operator python python operators += what does &amp; operator do in python operators in python% python // operator meaning python implement operators operators pyhton ^= operator python use of operator in python ? operator in python pythong operators &amp; operator python python operator : python what is &amp; operator python operator &quot;^&quot; what are python operators &quot;@&quot; python operator ~ python operator define operator in python : operator in python can we use &gt;= in with and operator in python ^^ python operator python ?? operator in python operator ? python operator python &quot;&lt;&gt;&quot; operator python3 operators python what is // operator % operator for what in python | operator in python * operator in python python syntax for and operator := operator python python | operator python operator meaning python &quot;@&quot; operator how to use and operator in python python ?: operator &amp;= operator in python and operator for python ! operator in python = \ python operator = \ python operator meaning of % operator in python the ? : operator in python all python operators what is operator do in python % operator python //= python operator using operators in python // operator work in python ... operator in python for &lt; operator python python operator. python operator cheatsheet % operator meaning python &quot;^ operator in python&quot; () operator in python all operators in python what is python // operator what is @ operator used for in python python all operators python operator &lt; def operators python python operator ** operators in python python operators how many operators in python == operator in python &lt;&gt; operator python &amp;= python operator what is // operator in python python operator //operator in python python .. operator how the |= operator works in python how the &amp;= operator works in python and operator python | operator python python operators cheat sheet or python operator * operator python python = operator &quot;&amp;&quot; operator in python how to use the or operator in python built in operators and functions python logical operators in python 3 ... operator python := python operator python operator // What is the AND operator in Python? ? operator python operators in python python ,= operator python |= operator python with operator python operators in python python ? operator equivalent python &amp; operator and or operator in python in operator python python &quot; \ &quot; operator python *** operator python *** operator &gt;= operator in python operator in python &gt;&gt; ^ operator python equivalent of operator in python @ operator python function operators python =&gt; operator python operator ? python python ^ operator meaning python ^^ operator // python operator python ** operator python ! operator === operator in python ** operator in python python operator ^ python &quot;:=&quot; operator what are logical operators in python types of operators in python with example // operator python |= operator python python operator % ^ operator in python &amp; operator in python ?? operator in python logical operators python python operators list python / operator python := operator python ... operator operator python is and operator in python python : operator python ^ operator &quot;:&quot; operator in python : operator in python operator in python @ python operator // operator in python python == operator python :&lt; operator ^ python operator ** operator python python basic operators operator // python python ./ operator // operator python mathematical operators in python % operator in python python /= operator 'and' operator in python logical operators in python and operator in python python * operator python ? operator what are operators in python python // operator python % operator python operator python @ operator python logical operators in operator in python python and operator ! operator python python operators
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source