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,
- Comments in Python Programming
- tkinter - Hello World! Program
- How to install Python 3.11 on Mac
- Python matplotlib segmentation fault: 11 macOS Big Sur
- Change label (text) color in tkinter
- Python Hello World! Program with code example (snippet)
- Calculate discount amount python code
- Take input argument from command line in Python Programming
- How to pip install Python Modules in VSCode
- Tkinter - add x and y padding to label text
- Python raise error with message example
- Check if String Contains a Substring - Python
- Python Program To Calculate Simple Interest (SimpleInterest.py)
- What does b prefix before a String mean in Python?
- What is Terminal Velocity and its Formula? How to calculate it programmatically?
- How to List all Packages installed using pip [Python]
- Convert Float to String in Python
- Change the background of Tkinter label or text
- How to Install Python Modules in VS Code
- Indent Python code in Notepad++
- Validate email address in Python using regular expression (regex)
- Python: Fix command not found pip or pip3 on zsh shell
- TypeError: must be str, not int [Fix Python]
- ModuleNotFoundError: No module named qdarkstyle.colorsystem [Python]
- Python - Convert float to String
More Posts:
- [fix] docker exec requires at least 2 arguments - Docker
- Setting up Zsh Syntax Highlighting - zsh
- Android Studio : Connection Error : Failed to download patch file - Android-Studio
- How to fix: You will need Google Chrome to install most apps, extensions and themes. - Chrome
- Replace new line with comma in Sublime Text Editor - Sublime-Text
- Enable JSON Pretty Print in Java Jackson - Java
- 9 Ways to Loop Java Map (HashMap) with Code Examples - Java
- [Solved] Notepad++ Menu Bar Missing - NotepadPlusPlus