If you see this, something is wrong
First published on Friday, Feb 20, 2026 and last modified on Friday, Feb 20, 2026
Arithmetic Operations
To begin, let's learn to use Python as a calculator, with the arithmetic operations, the addition, the subtraction, the multiplication, the power and the division.
Launch Anaconda in Spyder and follow me! The simpler way to use Python as a calculator is to directly write on the console. For instance, 2 + 4, and you obtain 6.
2+42 - 4 is -2,
2-42 times 4 is 8,
2*42 to the power 4 is 16,
2**4and 2 divided by 4 is 0.5.
2/4You can also use variables.
You type x equals 2, then the variable x is 2.
x=2y equals 4, the variable y is 4
y=4and z is x plus y.
z=x+yAnd if you want to show z, you type print z, and you obtain 6.
print(z)Another way to do it is to make a new file in the editor.
Then to save it and then you type into it.
x equals 2.
You have to use variables in the script.
y equals 4.
z equals x plus y.
And print z.
Then you save: File, save.
And then you run: run run.
And you obtain six in the console.
x=2
y=4
z=x+y
print(z)What's coming now? What's coming now are the trigonometric functions, with NumPy package.