How to make a calculator in Python?
Last week we talked to you about the while loops in Python, its characteristics and operation. Well, this week let's make use of them and we are going to schedule a simple calculator to practice.
If you want to continue learning about programming you can do so at EIP with our master in Advanced Programming in Python for Big Data, Hacking and Machine Learning.

We begin by collecting the two numbers with which our calculator is going to work, we create a variable for the selection of the operation that we want our calculator to perform and we create our loop with the list of options where the condition would be the user's choice to exit the program by pressing option 6.

After in operation function that you want to perform, would fall within one option or another of our 'if' or 'elif' conditional statements.
In option 4, division we convert the result into float to be able to print decimals, since otherwise it will only print the integer part, ignoring all decimals.
We are going to put it to the test, We enter the numbers 7 and 3.
Let's add them up, so we mark option 1 of our fantastic calculator and since we are wonderful programmers, it prints the line with the result of the sum, 7 + 3 = 10.
We try the rest of the operations and we see that they all work like a charm.
The option 5 It allows us to change the numbers to work with.
And the last option turns off our calculator by printing the goodbye message.