Varun Vemulapalli

Day 60 of 100 · Phase 7: GitHub Copilot

Hands-on: build a small working tool with GitHub Copilot

2 min readBy Varun Vemulapalli

Every loan page shows an EMI. Today you'll build the tool that calculates it, with Copilot.

You'll use everything from this week: instructions, Chat, agent, tests.

Video explainer · 1:56
Key takeaway

Clear rules, worked numbers and tests turn Copilot into a reliable builder, and you into the checker.

Day 60 visual: Hands-on: build a small working tool with GitHub Copilot
The visual from the original post.

The concept

EMI (equated monthly instalment): the fixed amount you pay each month until a loan is repaid. Early payments are mostly interest, later ones mostly principal.

EMI = P × r × (1 + r)^n ÷ ((1 + r)^n − 1)
P = loan amount, r = monthly rate (annual % ÷ 12 ÷ 100), n = months.

CLI (command-line interface): a small program you run in the terminal (Day 47).

Worked numbers (illustrative): 500,000 at 9% a year for 5 years.

  • r = 0.0075, n = 60
  • EMI ≈ 10,379.18 a month
  • Total paid ≈ 622,750.66, interest ≈ 122,750.66
  • Month 1 interest: 500,000 × 0.0075 = 3,750; the rest repays principal.

Your tool must reproduce these.

Walkthrough: build it with Copilot

1. Create a folder emi-calculator and open it in VS Code.
2. Add .github/copilot-instructions.md (Day 59): "Python, standard library only. Round money to 2 decimals for display. Every function has a test. Reject zero or negative amounts clearly."
3. In Chat, choose Agent: "Build emi.py, a CLI that takes amount, annual rate and years, and prints EMI, total paid and total interest, with an option to show the first 12 months of the schedule. Add tests in test_emi.py."
4. Review the plan and each diff.
5. Run: python emi.py 500000 9 5. Expect about 10,379.18.
6. Edge cases: rate 0 (the formula divides by zero; EMI should be 500,000 ÷ 60 = 8,333.33) and amount -1.
7. Wrong? Ask Chat to /fix it and rerun the tests.
8. Push to GitHub. On a paid plan, open an issue "Add CSV export of the schedule" and assign it to Copilot (Day 58).

Where you see it at work

  • Banking and FinTech: loan, mortgage and card instalment calculators.
  • Insurance: premium payment plans.
  • Retail: "buy now, pay later" instalments.
  • Business analysis: worked examples like the one above make great acceptance tests.
  • Product management: the 0% case belongs in the spec.

For learning only: real lenders add fees and rounding rules.

Try it today (10–15 min)

1. Do steps 1–6.
2. Check the result in a spreadsheet.
3. Ask Chat to /explain the formula line by line.
4. Docs: https://code.visualstudio.com/docs/agents/agents-tutorial and https://docs.github.com/en/copilot/get-started/best-practices

In one sentence

Clear rules, worked numbers and tests turn Copilot into a reliable builder, and you into the checker.

What small calculator from your work would you build next? 👇