Posts

Showing posts with the label arithmetic operators

Python Operators Explained for Beginners (+, -,/, %, //, **)

Python Operators Explained for Beginners (+, -, *, /, %, //, **) Python Operators Explained for Beginners (+, -, *, /, %, //, **) Introduction In the previous post, we learned about Python input and output. Now it’s time to perform calculations and operations using Python operators . Operators are symbols that tell Python to perform a specific operation. --- What is an Operator? An operator is a symbol used to perform operations on variables and values. Example: +, -, *, / are operators used for calculations --- 1️⃣ Addition Operator (+) The + operator is used to add two values. a = 10 b = 5 print(a + b) Output: 15 --- 2️⃣ Subtraction Operator (-) The - operator subtracts one value from another. a = 10 b = 3 print(a - b) Output: 7 --- 3️⃣ Multiplication Operator (*) The * operator multiplies values. a = 4 b = 5 print(a * b) Output: 20 --- 4️⃣ Division Operator (/) The / operator divides one value by another and alw...