Skip to content

NathanMwaura/SEE_Academy

Repository files navigation

Fun Calculator 🎉

Welcome to the Fun Calculator! This is a beginner-friendly Python script that lets users add, subtract, multiply, and divide two numbers interactively right from the command line. The program supports both whole numbers and decimals, making your calculations fancy and flexible!

Features

  • Addition ➕: Adds two numbers.
  • Subtraction ➖: Subtracts the second number from the first.
  • Multiplication ✖️: Multiplies the two numbers.
  • Division ➗: Divides the first number by the second (be careful with zero!).

How It Works

  1. User Input:
    You will be prompted to enter a first number and a second number. The inputs use float() to allow entry of decimal values for greater flexibility.

  2. Math Operations:
    The calculator will automatically compute and display:

    • The sum of the two numbers
    • The difference (first minus second)
    • The product
    • The quotient (first divided by second)
  3. Output:
    The results for all four operations are printed cleanly, so you get the full arithmetic picture in one go!

Example Usage

Enter the first number: 5.5
Enter the second number: 2
Results of your two numbers:
Sum: 7.5
Difference: 3.5
Product: 11.0
Quotient: 2.75

Installation & Running

  1. Copy the Script:
    Copy the Python code into a .py file (e.g., fun_calculator.py).

  2. Run the Calculator:
    Open your terminal (command prompt or shell), navigate to the script location, and run:

    python fun_calculator.py
    
  3. Follow Prompts:
    Enter two numbers as instructed.

Notes

  • Uses float() for inputs so you can calculate with decimals.
  • Does not perform error handling for division by zero, so make sure your second number isn't zero when dividing (or add a check if you'd like!).
  • The script keeps things simple and fun, ideal for beginners learning Python[3][5][7].

Customization Ideas

  • Add checks to prevent division by zero and handle invalid inputs.
  • Let the user select which operation(s) to perform.
  • Loop the calculator for multiple calculations until the user decides to exit.

Happy calculating! 😎💻

Inspired by classic beginner calculator examples from Python learning resources[1][3][7].

[1] https://www.programiz.com/python-programming/examples/calculator [2] https://python-forum.io/thread-4082.html [3] https://www.geeksforgeeks.org/make-simple-calculator-using-python/ [4] https://www.youtube.com/watch?v=yUrYouDQZL8 [5] https://builtin.com/software-engineering-perspectives/python-calculator [6] https://www.youtube.com/watch?v=tjfA130xWnw [7] https://gist.github.com/complxalgorithm/ee685852a2a37e88ebc8d64d2d126d91 [8] https://www.youtube.com/watch?v=yqgsr2nxQqM [9] https://www.codingal.com/coding-for-kids/blog/python-project-basic-calculator/ [10] https://www.sololearn.com/en/Discuss/2088675/a-simple-calculator [11] https://www.digitalocean.com/community/tutorials/how-to-make-a-calculator-program-in-python-3 [12] https://www.youtube.com/watch?v=k56qPoYXMNA [13] https://www.shiksha.com/online-courses/articles/calculator-program-in-python/ [14] https://support.templafy.com/hc/en-us/articles/15849622277021-How-to-use-functions-Add-Subtract-Multiply-and-Divide-to-calculate-with-numbers [15] https://www.youtube.com/watch?v=BX6_YBPr7Jw [16] https://discuss.python.org/t/calculator-help/39592 [17] https://www.upgrad.com/tutorials/software-engineering/python-tutorial/calculator-program-in-python/ [18] https://github.com/ANGI3MAINA/Functions-practice-building-a-calculator [19] https://tecadmin.net/simple-python-calculator-program/ [20] https://stackoverflow.com/questions/69429091/im-creating-a-very-crude-calculator-and-would-like-to-know-whats-wrong-with

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors