0% found this document useful (0 votes)
6 views1 page

Python Arithmetic Operators Cheat Sheet

Uploaded by

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

Python Arithmetic Operators Cheat Sheet

Uploaded by

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

Python Arithmetic Operators - Cheat Sheet

Python Arithmetic Operators

Python Arithmetic Operators

These are the basic operators used in Python to do math operations.

+ : Addition -> 5 + 3 = 8

- : Subtraction -> 5 - 3 = 2

* : Multiplication -> 5 * 3 = 15

/ : Division -> 5 / 2 = 2.5 (gives decimal)

// : Floor Division -> 5 // 2 = 2 (removes decimal part)

% : Modulus (Remainder) -> 5 % 2 = 1 (only remainder)

** : Exponent (Power) -> 2 ** 3 = 8 (2 raised to power 3)

Example:

a = 10

b=3

print("Add:", a + b) # 13

print("Subtract:", a - b) # 7

print("Multiply:", a * b) # 30

print("Divide:", a / b) # 3.33

print("Floor Divide:", a // b) # 3

print("Modulus:", a % b) #1

print("Power:", a ** b) # 1000

Use this to do calculations in your Python programs and convert flowcharts to code easily!

You might also like