Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2 views

Reference guide_ Python operators

This document serves as a reference guide to Python operators, detailing various types such as arithmetic, comparison, and logical operators. It emphasizes the importance of understanding these operators for effective Python programming and provides insights into their usage and syntax. Additionally, it offers resources for further practice and downloadable content for future reference.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Reference guide_ Python operators

This document serves as a reference guide to Python operators, detailing various types such as arithmetic, comparison, and logical operators. It emphasizes the importance of understanding these operators for effective Python programming and provides insights into their usage and syntax. Additionally, it offers resources for further practice and downloadable content for future reference.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Reference guide: Python operators

You’ve encountered many Python operators already. Many of them likely feel very familiar to you.
After all, there’s nothing novel about addition and subtraction in Python. But there are many more
operators than the ones used for basic arithmetic! Operators are characters that enact specific
arithmetic, logical actions, or processes. Data professionals use operators all the time in their
work, and they’re a rudimentary part of Python programming, so it’s important to learn them. This
reading is a guide to the various operators available to you in Python.

Save this course item


You may want to save a copy of this guide for future reference. You can use it as a resource for
additional practice or in your future professional projects. To access a downloadable version of
this course item, click the following link and select “Use Template.”
Reference guide: Python operators
OR
If you don’t have a Google account, you can download the item directly from the following
attachment.
Reference guide_ Python operators
DOCX File

Comparators
In Python, you can use comparison operators to compare values. When a comparison is made,
Python returns a Boolean result—True or False. Python uses the following comparators:

Notes:
● The single equals sign (=) is reserved for assignment statements. If you use a single
equal sign to make a comparison, the computer will return a SyntaxError.
● If you try to compare data types that aren’t compatible, like checking if a string is
greater than an integer, Python will throw a TypeError.

Logical operators
Python also has three logical operators that can be combined with comparators to create
more complex statements.
These operators are:
● and
○ evaluates to True only if both statements are true
● or
○ evaluates to True if one or both of the statements are true
● not
○ reverses the evaluation
○ If the statement evaluates to True, returns False; if the statement evaluates to
False, returns True

Examples:

Arithmetic operators
Python is also capable of performing mathematical operations using a set of built-in
operators. These arithmetic operators are:
There are many other mathematical operations that can be performed in Python using
functions from special libraries, which you’ll learn about later. Python uses a core set of
operators to make comparisons, perform logical operations, and compute arithmetic
operations. These operators can be combined in statements to perform an infinite number of
tasks and operations.

You might also like