Answer:
The Python programming language is a great tool to use when working with numbers and evaluating mathematical expressions. This quality can be utilized to make useful programs.
This tutorial presents a learning exercise to help you make a simple command-line calculator program in Python 3. While we’ll go through one possibile way to make this program, there are many opportunities to improve the code and create a more robust calculator.
We’ll be using math operators, variables, conditional statements, functions, and handle user input to make our calculator.
Prerequisites
For this tutorial, you should have Python 3 installed on your local computer and have a programming environment set up on the machine. If you need to either install Python or set up the environment, you can do so by following the appropriate guide for your operating system.
Step 1 — Prompt users for input
Calculators work best when a human provides equations for the computer to solve. We’ll start writing our program at the point where the human enters the numbers that they would like the computer to work with.
To do this, we’ll use Python’s built-in input() function that accepts user-generated input from the keyboard. Inside of the parentheses of the input() function we can pass a string to prompt the user. We’ll assign the user’s input to a variable.
For this program, we would like the user to input two numbers, so let’s have the program prompt for two numbers. When asking for input, we should include a space at the end of our string so that there is a space between the user’s input and the prompting string.
number_1 = input('Enter your first number: ')
number_2 = input('Enter your second number: ')
After writing our two lines, we should save the program before we run it. We can call this program calculator.py and in a terminal window, we can run the program in our programming environment by using the command python calculator.py. You should be able to type into the terminal window in response to each prompt.
Output
Enter your first number: 5
Enter your second number: 7
If you run this program a few times and vary your input, you’ll notice that you can enter whatever you want when prompted, including words, symbols, whitespace, or just the enter key. This is because input() takes data in as strings and doesn’t know that we are looking for a number.
Step-by-step explanation:
Hope This helps with your coding
( If it doesn't then sorry)