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,
- How to add two float numbers in Python
- tkinter - Hello World! Program
- Convert Float to String in Python
- ModuleNotFoundError: No module named qdarkstyle.colorsystem [Python]
- How to List all Packages installed using pip [Python]
- Check if String Contains a Substring - Python
- Change label (text) color in tkinter
- Where does brew install python in macOS
- Validate email address in Python using regular expression (regex)
- How to uninstall pip Python packages
- ModuleNotFoundError: No module named qdarkstyle.colorsystem [Python]
- Python: Fix command not found pip or pip3 on zsh shell
- Check version of pip package installer for Python
- 3 Python program to add two numbers
- Calculate discount amount python code
- How to add borders to tkinter label text
- How to install Python 3.9 using brew on Mac
- Python Program To Calculate Simple Interest (SimpleInterest.py)
- Comments in Python Programming
- What is Terminal Velocity and its Formula? How to calculate it programmatically?
- How to take user input from the console in a Python program
- Install and Run Jupyter Notebook on Mac (macOS)
- Tkinter - add x and y padding to label text
- 7 Python Arithmetic Operators with Examples [Tutorial]
- Python Sleep Function/Method Code Example
More Posts:
- Eclipse like Auto Import Shortcut in Intelij IDE Android Studio - Android-Studio
- Where are Notepad++ macros stored? - NotepadPlusPlus
- How to take a screenshot on a Mac? (updated for macOS Monterey 2022) - MacOS
- How to turn off AirPods Nearyby notifications on macOS Big Sur? - Apple
- The tag img may only appear as a descendant of tag noscript. Did you mean amp-img - AMP
- How to get Java Thread name Example [Program] - Java
- Install Eclipse IDE on M1 Mac Natively - Eclipse
- Turn Off Google Analytics intelligence Alert Emails - Google