List of Arithmetic Operations in Python:
- Addition: +
- Subtraction: -
- Multiplication: *
- Division: /
- Floor Division: //
- Modulus: %
- Exponential: **
Python Arithmetic Operators Examples
Addition: +
Example:
Output:# Python: Arithmetic Operator: Addition (+) Example number1 = 10; number2 = 20; #Addition sum = number1 + number2; print(sum);
30
Subtraction: -
Example:
Output:# Python: Arithmetic Operator: Subtraction (-) Example number1 = 30; number2 = 20; #Subtraction difference = number1 - number2; print(difference);
10
Multiplication: *
Example:
Output:# Python: Arithmetic Operator: Multiplication (*) Example number1 = 10; number2 = 20; #Multiplication mutiplicationResult = number1 * number2; print(mutiplicationResult);
200
Division: /
Example:
Output:# Python: Arithmetic Operator: Division (/) Example number1 = 20; number2 = 10; #Division divisionResult = number1 / number2; print(divisionResult);
10
Floor Division: //
Output:# Python: Arithmetic Operator: Floor Division (//) Example number1 = 21; number2 = 4; #Floor Division #Using Floor Division you get the rounded nearest whole number as the result. floorDivisionResult = number1 / number2; print(floorDivisionResult);
5
Modulus: %
Output:# Python: Arithmetic Operator: Modulus (%) Example number1 = 10; number2 = 2; #Modulus modulusResult = number1 % number2; print(modulusResult);
0
Exponentiation: **
Output:# Python: Arithmetic Operator: Exponentiation (**) Example number1 = 10; number2 = 5; #Modulus exponentialResult = number1 ** number2; print(exponentialResult);
100000







More Posts related to Python,
- Python: Convert Date to DateTime
- How to sort a List using Lambda in Python
- Python matplotlib segmentation fault: 11 macOS Big Sur
- What is Terminal Velocity and its Formula? How to calculate it programmatically?
- How to install Python 3.11 on Mac
- How to flatten a nested list in Python
- Python: Pandas Merge DataFrames on Index Example
- How to Run all Cells at Once Jupyter Notebook
- Python - Convert float to String
- How to add borders to tkinter label text
- How to Exit a Loop in Python Code
- [Python] Fix: ValueError: All arrays must be of the same length
- Sorting an array using Bubble Sort in Python Programming
- How to Unzip a file using Python
- Python: Merge DataFrames Pandas Outer Join Example
- Change label (text) color in tkinter
- Convert Float to String in Python
- Fix: fatal error: No such file or directory compilation terminated
- Python: Access index/counter of a for loop iteration
- Import Other Python Files Examples
- How to install Anaconda on Mac (M1/M2 Mac)
- Python Regular Expression to Find All Matches in List
- How to Read a binary File with Python
- How to disable warnings while Python file execution
- Know current Python Version
More Posts:
- How to Quit Applications on Mac Using Terminal - MacOS
- Quick way to setup AWS DynamoDB locally on macOS - AWS
- FCM Messages Test Notification!!!! - Microsoft Teams, Google Hangouts push alert - News
- Hide Navigation Bar from Android Screen Activity - Android
- Create SharePoint Site Collection with new Content database in existing web application - SharePoint
- How to install Python on Ubuntu - Ubuntu
- Notepad++ Export file as HTML - NotepadPlusPlus
- How to install Python Specific version (3.8, 3.9 or 3.10) using Brew - Python