What you'll build
Keep several scholarships under one label, then walk through them with a for loop and print each on its own line. The cleanest way to practice a list and a loop together.
Requirements
The must-do parts. If any are missing, we'll ask you to take another pass.
- Make a list of at least four scholarships (or universities) you're interested in.
- Use a
forloop to print each item on its own line — oneprint()you write once, not four. - After the loop, use
len()to print how many are on the list. - Use a four-space indent for the line inside the loop, and end the
forline with a colon.
Bonus, if you're feeling brave
- Number each line as you print it —
1. Chevening,2. DAAD, and so on. Look at howenumerate()works, or keep a counter that starts at 1. - Add a second indented line inside the loop that prints a short note, so two lines come out for every item.
Examples
What your program should look like when it runs. Lines starting with $ are typed by you; the rest is your program.
Example cell runs
Chevening — UK
DAAD — Germany
Mastercard Foundation — Canada
Fulbright — USA
4 scholarships on your shortlist.Where to start
Copy this scaffold into a new file. You don't have to use it — it's just a friendly nudge.
# Scholarship shortlist printer
scholarships = [
"Chevening — UK",
"DAAD — Germany",
# TODO: add at least two more
]
# TODO: use a for loop to print each one on its own line
# TODO: print how many there are with len()How we'll grade it
Four checks, four points. Three or above is passing — we'll ask you to revise anything we can't tick.
| Check | What we look for | Pt |
|---|---|---|
| It runs | Starts cleanly and prints the list without errors. | 1 |
| Real list and loop | There is an actual list with four or more items, and a `for` loop walks it — not four separate print statements. | 1 |
| Count is correct | The final line uses `len()` and shows the right number for the list. | 1 |
| Reads well | One item per line, clean output, no debug noise. | 1 |