How do i basic maths in python?
-
Number crunching is one of the main uses of computing. The basic maths in python is similar to what we learnt in school,
+
Add up two numbers: e.g: a = 1 + 2
Ans: 3-
Subtract two numbers: e.g: a = 2 -1
Ans: 1*
Multiple two numbers: e.g: a = 2 * 2
Ans: 4/
Divide two numbers: e.g: a = 10 / 2
Ans: 5.0**
Exponential values, like 10 to the power of 2: e.g: a = 10 ** 2
Ans: 100%
Modulo is the remainder: e.g: a = 11 % 3
Ans: 2
© Lightnetics 2024