if and loops — a preview of next weekToday 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.
name = input("What is your name? ")
age = int(input("How old are you? "))
print(f"Name: {name}")
print(f"Age: {age}")
A variable is a labelled box that holds a value. Every value has a type — the four you'll meet constantly:
name = "Aisha" # str — text
age = 19 # int — whole number
height = 1.62 # float — decimal
enrolled = True # bool — True / False
ints; you can't add an int to a str without converting first.
input() is always a string — convert it# 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
int(input(...)) or float(input(...)). Forget the wrapper and your maths breaks.
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.
You've seen these — next week we go deep. A quick reminder of the shapes:
age = 19
if age >= 18:
print("Adult")
else:
print("Minor")
# Do something a fixed number of times:
for i in range(3):
print("Hello!")
# → Hello! Hello! Hello!
Input, conversion, a variable, and an f-string — that's today's project in miniature.
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}")
input() · int() · variables · f"…" — every idea from this week.
int() around input() when you need a number.f before a string — "Hi {name}" prints the braces literally."Age: " + 19 crashes — convert with str() or use an f-string.: after if, for, or a def line.Ask for name, age, city, favourite language, and years coding. Then print a tidy, multi-line bio block with f-strings.
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.)
students/<your-username>/D05_about_me.py. Full brief in lab/module_1_foundations/D05_about_me/problem.md. PR against upstream main before 12:00.
if / elif / else deep dive on Day 6.