Welcome to your first homework! It has three parts:
Deadline: before Workshop 2.
How to submit: push everything to a GitHub repository (see Part 2) and send the repository link to your instructor.
Create a file called answers.md and answer the following questions in your own
words (1–3 sentences each is enough). Use the links at the bottom if you get stuck.
- What is Git and what problem does it solve?
- What is a version control system (VCS)?
- What is a repository (repo)?
- What is a commit? Why do we write a commit message?
- What is the difference between
git addandgit commit? - What does
git pushdo? What doesgit pulldo? - What is a branch and why is it useful?
- What is GitHub and how is it different from Git?
- Name two alternatives to GitHub (e.g. other websites that host Git repos).
- What is the difference between a public and a private repository?
- What is a
README.mdfile and what is it used for? - What is a
.gitignorefile and why would you not want to commit every file?
Tip: answer honestly from what you understand. It is fine to be wrong — we will review the answers together in the next workshop.
Follow these steps. If a command fails, read the error message carefully — it usually tells you what is wrong.
- Install Git: https://git-scm.com/downloads
- Create a free GitHub account: https://github.com/signup
Check that Git is installed by running this in your terminal:
git --versionYou should see something like git version 2.43.0.
git config --global user.name "Your Name"
git config --global user.email "you@example.com"- Click the + in the top-right corner of GitHub → New repository.
- Name it
python-homework(or anything you like). - Keep it Public, check Add a README file, then click Create repository.
Copy the repo URL (green Code button) and run:
git clone https://github.com/your-username/python-homework.git
cd python-homeworkPut your answers.md (Part 1) and your Python files (Part 3) inside this folder.
git add .
git commit -m "Add workshop 1 homework"
git pushRefresh your repository page on GitHub — your files should be there. 🎉
If you get stuck, take a screenshot of the error and bring it to the next workshop.
Create the files below and write Python code to solve each task. Use only what we covered in Workshop 1: variables, data types, type casting, and arithmetic / comparison operators.
Run each file with:
python exercise_1.pyCreate variables for your name (str), age (int), and height in meters (float).
Print a sentence using an f-string, for example:
My name is Nino, I am 21 years old and 1.65 meters tall.
The code below crashes. Explain in a comment why it crashes, then fix it using
type casting so it prints 30.
a = 10
b = "20"
print(a + b)Create two variables width and height (numbers of your choice). Calculate and
print the area (width * height) and the perimeter (2 * (width + height)).
Create a variable number. Use the modulus operator (%) and a comparison
operator to print whether the number is even. The result should be a boolean, e.g.:
number = 7
print("Is even:", number % 2 == 0) # Is even: FalseThere are 60 seconds in a minute, 60 minutes in an hour, and 24 hours in a day. Using variables and multiplication, calculate and print how many seconds are in a day. Then print how many seconds are in a week.
-
answers.mdwith the Git / GitHub questions answered -
exercise_1.py…exercise_5.pywritten and runnable - Everything pushed to your GitHub repository
- Repository link sent to the instructor
- Git handbook (short): https://docs.github.com/en/get-started/using-git/about-git
- "Hello World" GitHub guide: https://docs.github.com/en/get-started/start-your-journey/hello-world
- Git cheat sheet (PDF): https://education.github.com/git-cheat-sheet-education.pdf
- Interactive Git practice: https://learngitbranching.js.org/