WWW W3schools Com Python Python Operators ASP
WWW W3schools Com Python Python Operators ASP
Python Operators
❮ Previous Next ❯
Python Operators
Operators are used to perform operations on variables and values.
In the example below, we use the + operator to add together two values:
Example
print(10 + 5)
Run example »
Python divides the operators in the following groups:
Arithmetic operators
Assignment operators
Comparison operators
Logical operators
Identity operators
Membership operators
Bitwise operators
Python Arithmetic Operators
Arithmetic operators are used with numeric values to perform common mathematical
operations:
| OR Sets each bit to 1 if one of two bits is 1
^ XOR Sets each bit to 1 if only one of two bits is 1
~ NOT Inverts all the bits
Exercise:
Multiply 10 with 5 , and print the result.
print(10 5)
Submit Answer »
Start the Exercise
❮ Previous Next ❯
NEW
We just launched
W3Schools videos
Explore now
COLOR PICKER
Get certified
by completing
a course today!
school
w3 s
1
02
CE
TI 2
R
FI .
ED
Get started
CODE GAME
Play Game
Get Certified »
W3Schools is optimized for learning and training. Examples might be simplified to improve reading and
learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant
full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use,
cookie and privacy policy.
Copyright 19992021 by Refsnes Data. All Rights Reserved.
W3Schools is Powered by W3.CSS.