Skip to content

Week 1 · Python and your developer toolkit

Guided build: Git, GitHub and your first script

Put your course folder under version control, build a small order summary script step by step and publish it to GitHub.

Guided buildEstimated time: 2 h

In this build you'll set up the repository you'll use for the whole course, write a script that summarises a day's orders, and publish it to GitHub. Work through the steps in order. Each one ends with something you can run or check.

Why Git?

Git records snapshots of your project, called commits, so you can see what changed, when and why, and go back if something breaks. GitHub is a website that stores your Git projects online, so you can share them, back them up and work with others.

Every engineering team uses them. As an FDE, your customer's code, your deployments and your capstone will all live in Git.

Step 1: Turn your folder into a repository

Go to your course folder and start tracking it with Git:

cd ~/projects/fde-course
git init
git status

git init creates a repository: a hidden .git folder that stores the history. git status shows what Git sees. Right now it lists hello.py as untracked: Git sees the file but isn't saving its history yet.

Step 2: Make your first commit

Saving a snapshot takes two commands:

git add hello.py
git commit -m "Add hello script"
  1. git add puts a file in the staging area: the list of changes that go into the next snapshot.
  2. git commit saves the snapshot, with a message describing what changed.

Run git status again: it now says the working tree is clean, meaning everything is saved.

Step 3: Ignore files that don't belong in Git

Some files should never be committed: virtual environments, secret keys and system files. Create a .gitignore file in ~/projects/fde-course with this content:

.gitignore
.venv/
.env
__pycache__/
.DS_Store

Then commit it:

git add .gitignore
git commit -m "Add gitignore"

You'll need the .env line in week 4, when you first use an API key.

Step 4: Start the order summary script

Create a folder for this week, and a script inside it:

mkdir week-01
code .

In VS Code, create week-01/orders.py with today's orders:

week-01/orders.py
orders = [
    {"id": "A101", "customer": "Ali Traders", "total": 4500, "status": "delivered"},
    {"id": "A102", "customer": "Noor Foods", "total": 12800, "status": "pending"},
    {"id": "A103", "customer": "Zain Electronics", "total": 2300, "status": "delivered"},
    {"id": "A104", "customer": "Ali Traders", "total": 7600, "status": "cancelled"},
    {"id": "A105", "customer": "Hira Textiles", "total": 15200, "status": "pending"},
]

print(f"Orders today: {len(orders)}")

Run it from the terminal:

python3 week-01/orders.py

You should see Orders today: 5. Commit it:

git add week-01/orders.py
git commit -m "Add order count"

Step 5: Add up the revenue

Cancelled orders don't count as revenue. Add this to the end of orders.py:

revenue = 0
for order in orders:
    if order["status"] != "cancelled":
        revenue += order["total"]
print(f"Revenue (excluding cancelled): Rs {revenue:,}")

Run it. The new line should say Rs 34,800. Check the number yourself: 4,500 + 12,800 + 2,300 + 15,200. Checking your program's output by hand is a habit worth building now.

Commit with a message that describes the change.

Step 6: List the pending orders

The operations team wants to know which orders still need shipping. Add:

print("Pending orders:")
for order in orders:
    if order["status"] == "pending":
        print(f"  {order['id']}  {order['customer']}  Rs {order['total']:,}")

Run the whole script. The output should be:

Orders today: 5
Revenue (excluding cancelled): Rs 34,800
Pending orders:
  A102  Noor Foods  Rs 12,800
  A105  Hira Textiles  Rs 15,200

Commit, then look at your history:

git log --oneline

Each line is one snapshot, newest first.

Step 7: Publish to GitHub

Create a repository on GitHub and upload your history in one command:

gh repo create fde-course --public --source=. --remote=origin --push

This creates a public repository called fde-course on your GitHub account, links your folder to it under the name origin, and pushes your commits. Open it in the browser with:

gh repo view --web

Step 8: Add a README and push again

A README is the front page of a repository. Create README.md in ~/projects/fde-course:

README.md
# FDE course work

My code for the Forward Deployed Engineer Training Program.

## Week 1

- `week-01/orders.py`: summarises a day's orders, with revenue and pending orders.

Commit it, then send the new commit to GitHub:

git add README.md
git commit -m "Add README"
git push

Refresh the page on GitHub: your README now shows under the file list.

The everyday loop you'll repeat all program is: edit, run, git add, git commit, git push.

Stuck?Show hints
  • fatal: not a git repository: you're in the wrong folder. Run cd ~/projects/fde-course and try again.
  • Author identity unknown: you skipped the Git name and email in the setup guide. Set them, then commit again.
  • gh repo create says the name already exists: you already have a repository called fde-course. Use a different name, such as fde-course-2026.
  • KeyError: 'staus': a dictionary key is misspelled. Keys must match exactly, including capital letters.

Finished this lesson?