Lessons 3-5

Lesson 3 - Basic Data Structures
Lesson 4 - Conditional Structures: Conditional Statements
Lesson 5 - Loops

Objective: Create a Python program that functions as a simple calculator. This project will help you practice the concepts learned in Lessons 3, 4, and 5.

Components of an Effective Solution

  1. Welcome Message:

    Display a welcome message to greet the user.

  2. User Input (Hard-coded):

    Initialize variables num1, operator, and num2 with hard-coded numeric values and an operator (+, -, *, /, %).

  3. Calculation:

    • Use conditional statements (if-elif-else) to perform the corresponding arithmetic operation based on the operator.

    • Supported operations include addition, subtraction, multiplication, division, and modulo.

    • Handle division by zero and modulo by zero cases with error messages.

  4. Result Display:

    • Check if a valid result has been calculated.

    • If a valid result is available, display it in a formatted message.

  5. Error Handling:

    Provide error messages for invalid operators and division/modulo by zero errors.

  6. Closing Message:

    Display a closing message to thank the user for using the Mini Calculator.

Key Points

  • The project adheres to your constraints by avoiding input functions, function definitions, import statements, and try-except statements. (Concepts we will cover in the last two lessons)

  • It uses hard-coded values for the calculation to demonstrate the program's functionality.

  • The program is structured with clear sections for input, calculation, result display, error handling, and messages.

  • Supported arithmetic operations are included, and the code handles common error scenarios.

  • The project is designed to be a simple calculator for educational purposes, focusing on basic Python concepts without relying on advanced features.