One shot, a lot of points.

--Originally published at Welcome to the Heaven

Hi folks!! Today we will learn a lot of important topics in Python 3, like “Basic Output and Input”, “functions”, “use of if, elif and else” and how to make a “Loop” with while in a polite calculator.

The first step is create a function and the way to create a function is write def, next to the name of the function with parentheses and two points. Inside the parentheses we can write the variables that you’ll use in the function. #def is a block keyword to say to the computer that we’ll create a function an what will be its name

Example:screen-shot-2016-09-14-at-11-50-55-pm

After that we begin to write all the code of the function, in the case of the calculator we star with a output and input, to make the user feel comfortable.screen-shot-2016-09-15-at-12-06-21-am

In this case our Output is print(“Welcome”) that will say to the user the word <Welcome> and in the next line the Input will put <Do you want to use my Calculator? >   where you can write yes or noscreen-shot-2016-09-15-at-12-18-42-am

Okay, know we use a Loop with while, because we want that our calculator will never end if we don’t want so we write:screen-shot-2016-09-15-at-12-22-57-am

That’s means the program doesn’t have end if we write yes. In the final to close the loop we write. #<okay Bye> is only to be politescreen-shot-2016-09-15-at-12-26-29-am

When we have our loop, we can write the operations that our calculator will use. This prototype only work with addition, subtraction, multiplication and division, if you want you can make it work with more functions, like sin or cos…

The way to do all the operations is with the use of if, elif, input and output. Is pretty easy to do with this conditionals because the operations don’t need to import a

screen-shot-2016-09-15-at-12-40-00-am
screen-shot-2016-09-15-at-12-43-13-am
or module.screen-shot-2016-09-15-at-12-40-00-am

Now you can see the code that will make the calculator do operations all the time that you want if you answer yes and if you want to see how the program runs…screen-shot-2016-09-15-at-12-43-13-am

This calculator is for bilingual people

This program is only for Python 3

Source: http://www.learnpython.org/en/Functions

Another Source: http://www.lawebdelprogramador.com/codigo/Python/3188-Calculadora.html