>> Module 01 / Day 05 / Lecture

Week 1 Recap + About Me

Day 5 of a 40-day journey
It's Friday. Let's pull this week's pieces together — then build your first mini-project.
Lecture
75 min · 09:00–10:15
Lab
60 min · About Me script
Module
M1 · Python Foundations
DAY 05 / 40
>> Today's roadmap

A quick recap, then we build

  1. Week 1, in one breath — what you already know
  2. Variables & types — the four you use every day
  3. Input + type conversion — the front door, revisited
  4. f-strings — formatting output the right way
  5. A taste of if and loops — a preview of next week
  6. Lab — your first mini-project: About Me
>> The hook

Five days ago, you'd never written a line of Python.

Today you can store data, read input, do maths, make decisions, and repeat work automatically. That's most of programming. To prove it, your Friday project is a program that introduces you.

about_me_preview.py
name = input("What is your name? ")
age  = int(input("How old are you? "))
print(f"Name:  {name}")
print(f"Age:   {age}")
>> Recap 01 / 04 · Variables & types

A box, a label, and a kind of thing

A variable is a labelled box that holds a value. Every value has a type — the four you'll meet constantly:

types.py
name    = "Aisha"     # str  — text
age     = 19          # int  — whole number
height  = 1.62        # float — decimal
enrolled = True       # bool — True / False
Types matter.
The type decides what you can do with a value. You can add two ints; you can't add an int to a str without converting first.
>> Recap 02 / 04 · Input + conversion

input() is always a string — convert it

convert.py
# input() hands you text — every time
age_text = input("How old are you? ")
# age_text is the str "19", not the number 19

# Wrap it to get a real number:
age = int(input("How old are you? "))   # whole number
pay = float(input("Hourly rate? "))   # decimal
The reflex.
Want a number from the user? int(input(...)) or float(input(...)). Forget the wrapper and your maths breaks.
>> Recap 03 / 04 · f-strings

f-strings — drop values straight into text

fstrings.py
name = "Aisha"
city = "Pune"
years = 2

# Put an f in front, then {variables} inside the string:
print(f"{name} is from {city}.")
# → Aisha is from Pune.

# You can do maths inside the braces too:
print(f"In 3 years: {years + 3} years of coding.")
# → In 3 years: 5 years of coding.
>> Recap 04 / 04 · A taste of decisions & loops

Making choices and repeating work

You've seen these — next week we go deep. A quick reminder of the shapes:

decide.py
age = 19
if age >= 18:
    print("Adult")
else:
    print("Minor")
repeat.py
# Do something a fixed number of times:
for i in range(3):
    print("Hello!")
# → Hello! Hello! Hello!
>> Putting it together

All of Week 1, in one little program

Input, conversion, a variable, and an f-string — that's today's project in miniature.

mini_bio.py
name  = input("What is your name? ")
age   = int(input("How old are you? "))
lang  = input("Favourite language? ")

print(f"Name:      {name}")
print(f"Age:       {age}")
print(f"Codes in:  {lang}")
>> Common failures

Five Week-1 mistakes to avoid today

  1. Forgetting int() around input() when you need a number.
  2. Forgetting the f before a string — "Hi {name}" prints the braces literally.
  3. Adding a number to text directly: "Age: " + 19 crashes — convert with str() or use an f-string.
  4. Mis-spelling a variable name later than where you defined it — Python is case-sensitive.
  5. Forgetting the colon : after if, for, or a def line.
>> 11:00 – 12:00 · Lab

Today's mini-project — About Me

THE BRIEF
about_me()

Ask for name, age, city, favourite language, and years coding. Then print a tidy, multi-line bio block with f-strings.

★ STRETCH
Validate the input

Re-prompt if the name is empty, and re-prompt if age isn't a whole number. (try/except lands on D28 — peek if you're curious.)

>> End of Week 1

What you can now do

  • ✓ Store data in variables and name the four core types.
  • ✓ Read user input and convert it to the right type.
  • ✓ Format clean output with f-strings — and ship a whole mini-project as a PR.
01 / 11
←/→ navigate   F fullscreen   Ctrl/⌘+P save as PDF