A simple Python calculator library for practicing GitHub workflows and team collaboration.
calc_lib.py- A library containing basic arithmetic functionscalc_demo.py- A demo script that uses the calculator library
No external dependencies required! This project uses only Python's standard library (3.6 or higher).
Run the demo script:
python calc_demo.pyOr import the calculator library in your own code:
from calc_lib import add, subtract, multiply, divide
result = add(5, 3)
print(result) # Output: 8The calculator library provides four basic operations:
add(a, b)- Returns the sum of a and bsubtract(a, b)- Returns a minus bmultiply(a, b)- Returns the product of a and bdivide(a, b)- Returns a divided by b (raises ValueError if b is zero)
Here are some ideas for practicing Git and GitHub:
- Create branches - Practice feature branches and merging
- Add a new function - Try adding
power(a, b)ormodulo(a, b) - Fix a bug - Intentionally introduce a bug and practice fixing it via pull request
git clone https://github.com/username/repo-name.git
cd repo-nameNote that you cannot create a branch directly in someone else's repository if you're not a collaborator. However, on GitHub you can click "Fork" button to copy the repo to your account.
git checkout -b feature-branch-name(This creates the branch and switches to it in one command)
Edit the files using your text editor, then:
git status # See what files you changed
git add . # Stage all changed filesgit commit -m "Add power function to calculator"git push origin feature-branch-name- Go to GitHub and click "Compare & pull request"
- Add description and request review
- Merge via the web interface