0% found this document useful (0 votes)
5 views3 pages

Python Programming Operators Guide

The document discusses three types of operators in Python programming: arithmetic, logical, and conditional operators. Arithmetic operators perform mathematical operations, logical operators handle boolean values, and conditional operators compare values. These operators are essential for performing operations, controlling program flow, and making decisions in Python.

Uploaded by

02230264.cst
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

Python Programming Operators Guide

The document discusses three types of operators in Python programming: arithmetic, logical, and conditional operators. Arithmetic operators perform mathematical operations, logical operators handle boolean values, and conditional operators compare values. These operators are essential for performing operations, controlling program flow, and making decisions in Python.

Uploaded by

02230264.cst
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

OPERATORS IN PYTHON PROGRAMMING

1. Arithmetic Operators:
- Arithmetic operators are used to perform mathematical
operations on numeric values.
- Examples include addition (`+`), subtraction (`-`), multiplication
(`*`), division (`/`), modulus (`%`), and exponentiation (`**`).
# Arithmetic operators
x = 10
y=3
print(x + y) # Output: 13
print(x - y) # Output: 7
print(x * y) # Output: 30
print(x / y) # Output: 3.3333333333333335
print(x % y) # Output: 1
print(x ** y) # Output: 1000

2. Logical Operators:
- Logical operators are used to perform logical operations on
boolean values (`True` or `False`).
- Examples include logical AND (`and`), logical OR (`or`), and
logical NOT (`not`).
- Example code:hjnuuuuuuuuuuuuuuuuuuuuuuuun
# Logical operators
OPERATORS IN PYTHON PROGRAMMING
x = True
y = False
print(x and y) # Output: False
print(x or y) # Output: True
print(not x) # Output: False

3. Conditional Operators (Comparison Operators):


- Conditional operators are used to compare values and return a
boolean result.
- Examples include equal to (`==`), not equal to (`!=`), greater than
(`>`), less than (`<`), greater than or equal to (`>=`), and less than or
equal to (`<=`).
- Example code:

# Conditional operators
x = 10
y=5
print(x == y) # Output: False
print(x != y) # Output: True
print(x > y) # Output: True
print(x < y) # Output: False
print(x >= y) # Output: True
print(x <= y) # Output: False
OPERATORS IN PYTHON PROGRAMMING

These operators are fundamental in Python programming and are


used extensively to perform various operations, control program
flow, and make decisions based on conditions.

You might also like