Python TutorialLesson 13Free preview
Python Operators
This lesson is part of Python · All levels
Summary
Operators in Python include arithmetic for computation, comparisons to compare values, logic to combine conditions, to assignments such as += that update the value of a variable. Each operator has a rule of priority that determines the order of the calculations, and parentheses can be used to force a particular order. Understanding operators well makes our expressions accurate and easy to read.
Key points
- Arithmetic operators include +, -, *, /, //, %, and **.
- The comparison operator produces bool values such as ==,!=, >, and <.
- The logic operators and, or, and not combine several conditions.
- An assignment operator like += adds value and then overlaps the variable.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.