HomePython Page 6 - Python Conditionals, Lists, Dictionaries, and Operators
Operators - Python
In our last article we learned how to get input from the user, store data in a variable, and work with some basic operators to manipulate that data. In this article we will learn to use Conditional Statements and possibly create functions. So wipe that mustard off your chin, clean the dishes, and let's get to work.
The following is a list of operators you can use in Python:
Symbol
Type
What it Does
+
Mathematical
Addition
-
Mathematical
Subtraction
*
Mathematical
Multiplication
/
Mathematical
Division
//
Mathematical
Truncating Division
**
Mathematical
Powers
%
Modulos
Returns the remainder from a division
<<
Shift
Left Shift
>>
Shift
Right Shift
&
Logical
And
|
Logical
Or
^
Logical
Bitwise XOR
~
Logical
Bitwise Negation
<
Comparison
Less than
>
Comparison
Greater than
'=='
Comparison
Equal to
!=
Comparison
Not Equal To
>=
Comparison
Greater than or Equal To
<=
Comparison
Less than or Equal To
'='
Assignment
Assigns a value
+=
Assignment
Adds and assigns a value
-=
Assignment
Subtracts and Assigns a value
*=
Assignment
Multiplies and assigns a value
/=
Assignment
Divides and assigns a value
//=
Assignment
Truncate Divides and assigns a value
**=
Assignment
Powers and assigns
%=
Assignment
Modulus and assigns
>>
Assignment
Shifts and assigns
<<
Assignment
Shifts and assigns
And
Boolean
Or
Boolean
Not
Boolean
Unfortunately I don't have time to discuss these operators in this tutorial, but join me for the next episode where I will be discussing Sets and how to manipulate data with the rest of these operators. Thanks again for stopping by and remember to check in often for new series from yours truly and others.