Project Level 2: Intermediate
This project is designed for intermediate learners who know Python fundamentals and are practicing building complete programs.
Project Description
Create a command-line calculator that performs basic mathematical operations such as:
Addition
Subtraction
Multiplication
Division
Power (exponentiation)
How the Project Works
As shown above, the program prompts the user to enter an expression (e.g., 6 + 5). Once the user enters the expression and presses Enter, the program shows the result (i.e., 11). Then, the program prompts the user again to enter another expression. This loop continues until the user enters “exit” to exit the program.
Prerequisites
Required Libraries: No libraries are required.
Required Files: No files are required.
IDE: You can use any IDE on your computer to code the project.
Danger Zone
Feel free to see the hints below. It’s fine to get some help.
Once you code the project, compare it with our solution below:
print("text-based calculator")
print()
expresion = input("ingrese expresion: ")
while expresion != "exit":
print(eval(expresion))
expresion = input("ingrese expresion: ")