Prerequisites — Exercises
Try these without looking at the solutions first. They combine everything you learned.
Exercise 1: Project Setup (Terminal + Git + Markdown)
- Create a folder called
my-portfolioin/tmp - Inside it, create these files:
README.md,about.md,projects.md - Initialize a git repository
- Write a README.md with:
- Your name as a heading
- A short bio in a paragraph
- A list of skills
- A link to your GitHub
- Stage and commit with message "Initial commit"
- Add a line to
about.md, stage and commit with message "Add about page"
Exercise 2: Python Word Counter
Write a Python script counter.py that:
- Reads a text file provided as a command-line argument
- Counts the number of lines, words, and characters
- Prints the results in a formatted table
Example output:
File: sample.txt
Lines: 12
Words: 145
Chars: 823
Test it with a file you create.
Exercise 3: TypeScript Data Fetcher
Write a TypeScript script weather.ts that:
- Defines an interface
Weatherwithtemperature,condition, andcity - Fetches from
https://jsonplaceholder.typicode.com/todos/1(not real weather, but practice) - Maps the response to a Weather-like object
- Prints "City: {city}, Temperature: {temp}°C, Condition: {condition}"
Exercise 4: Git Workflow Challenge
- Create a new folder
/tmp/git-flowand init a git repo - Create a file
main.pywithprint("Hello")— commit - Create a branch called
feature/greet - On that branch, modify
main.pyto ask for a name and greet them - Commit the change
- Switch back to
main - Merge
feature/greetintomain - Delete the feature branch
- View the log to verify
Exercise 5: Cross-Topic Challenge
Combine everything:
- Create a folder
cross-challengeand init git - Write a Python script
data.pythat generates 100 random "people" (name, age, city) and saves aspeople.json - Write a TypeScript script
report.tsthat readspeople.json, filters to people over 18, and prints a markdown-formatted table of results - Write the output to a file
adults.md - Commit all changes with a good commit message
- View the log and diff
Exercise 6: Bash Pipeline
Write a one-liner command that:
- Finds all
.pyfiles in the current directory - Counts the total lines of Python code
- Saves the count to
loc.txt
Hint: use find, xargs, wc, and >.
Exercise 7: Markdown to HTML
Create a markdown file recipe.md for your favorite recipe that includes:
- A heading with the recipe name
- An ingredients list (unordered)
- Step-by-step instructions (ordered)
- A bold tip at the end
- A code block with the cooking time in minutes
Then use a markdown-to-HTML converter (many exist online) to see it rendered.