Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Calculator Project

Pau Erola, 2025

A simple Python calculator library for practicing GitHub workflows and team collaboration.

Files

  • calc_lib.py - A library containing basic arithmetic functions
  • calc_demo.py - A demo script that uses the calculator library

Setup

Requirements

No external dependencies required! This project uses only Python's standard library (3.6 or higher).

Usage

Run the demo script:

python calc_demo.py

Or import the calculator library in your own code:

from calc_lib import add, subtract, multiply, divide

result = add(5, 3)
print(result)  # Output: 8

Functions

The calculator library provides four basic operations:

  • add(a, b) - Returns the sum of a and b
  • subtract(a, b) - Returns a minus b
  • multiply(a, b) - Returns the product of a and b
  • divide(a, b) - Returns a divided by b (raises ValueError if b is zero)

Practice Tasks

Here are some ideas for practicing Git and GitHub:

  1. Create branches - Practice feature branches and merging
  2. Add a new function - Try adding power(a, b) or modulo(a, b)
  3. Fix a bug - Intentionally introduce a bug and practice fixing it via pull request

Workflow example

1. Clone a repository

git clone https://github.com/username/repo-name.git
cd repo-name

Note 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.

2. Create and switch to a new branch

git checkout -b feature-branch-name

(This creates the branch and switches to it in one command)

3. Make your edits

Edit the files using your text editor, then:

git status                    # See what files you changed
git add .                     # Stage all changed files

4. Commit your changes

git commit -m "Add power function to calculator"

5. Push the branch to GitHub

git push origin feature-branch-name

6. Merge into main branch

  • Go to GitHub and click "Compare & pull request"
  • Add description and request review
  • Merge via the web interface

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages