BASIC PYTHON CALCULATOR
We have to first make our own functions by the attribute def. As we are going to use the trig ratios, exponent pow and squareroot. We have to import a module, that module is math
import math
Now let’s define our functions:
After defining our functions we have to take input from user, but before we take input from user we have to alert the user of the options available to use as below:
We then make a variable as above ,I named mine choice you can name yours anything you want. The variable should be take input from user which will be stored for future use.
Now after doing that, as you saw above our calculator will only hold two variable X and Y.
We have to make the x and y variables which will allow the user to enter input any number they want which will be in a FLOAT in order to obtain numbers with decimals:
X = num1
Y = num2
We have to include an if else and elif statement to make the code be able to execute what the user has bid for:
WELL DONE YOUR CALCULATOR IS COMPLETE SAVE IT AS BASICCALCULATOR.PY
Don’t worry about the last statement you can add it if you want to execute your program at the command line.
END!!!!!!!!!!!!!!!!
Download Source Code Of Basic Python Calculator : – Click here
0 comments:
Post a Comment