The problem
You are applying to twelve universities. Every one of them wants the same letter — your background, your research interest, why you would be a good fit. But each letter needs a different school name, a different programme name, and a different reason for choosing that particular place.
So you write the letter once. Then you copy it, change three things, save it under a new name. Then you do that again. And again. Twelve times.
Somewhere around the eighth copy, you send Oxford a letter that thanks Cambridge for its excellent department. Everybody does this. It is not carelessness — it is what happens to human attention on the eleventh repetition of a boring task.
This is exactly the kind of job a computer is good at and you are not.
What your program does
- You keep your universities in one file — a row for each: the school, the programme, and the one sentence about why you want to go there.
- You write your letter once, leaving blanks where those details belong.
- Your program loops over the rows. For each one, it fills the blanks with that school's details.
- It saves a separate document for each school, named after the school, into a folder.
Four steps. You already know how to do three of them — reading a file, looping over rows, and building a string with the pieces filled in. The fourth is the one you will have to go and learn.
What you'll be holding at the end
A folder on your computer with twelve documents in it. Each one addressed to the right school, naming the right programme, giving the right reason. Each one ready to attach to an email.
Run the program again next week with a thirteenth university added to the file, and you get thirteen documents in about one second.
What you'll have to find out
These are the questions you take to the docs, to an AI, or to me. Nobody has taught you the answers.
- How do you get Python to write a Word document, or a PDF? Python can write plain text with
open()— but a real document is a different kind of file. - Once you know how, which of the two is easier for a beginner? Try both if you have time; pick one if you don't.
- How do you save many files, each with a different name, from inside a loop?
- How do you make sure a school with a space in its name — University of Ghana — becomes a sensible filename?
Remember the recipe: say the problem in plain words, find the box, install it, find the smallest example that works, run it, check it, then use it in your own function.
Requirements
To pass, your project must:
- Read your universities from a file, not a list typed into the middle of your program. Someone should be able to add a university without touching your code.
- Use at least one function you wrote, with parameters and a return value.
make_letter(school, programme, reason)is the obvious one. - Produce one document per university, correctly filled in.
- Come with a README that says what it does, how to run it, one thing it can't do, and one thing you would add next.
- Be something you can explain out loud, line by line. If a line is in your program and you cannot say what it does, either find out or take it out.
Done, and going further
Done is one letter, for one university, written to a document by your program. That is a pass, and it is a real achievement — you found a library nobody taught you and made it do something.
Going further, if you have the appetite:
- All twelve, in one run.
- An index file listing every letter you generated, with the date.
- A matching email draft for each school, saved alongside the letter.
- Read the reason-for-choosing from the file too, so no text is hard-coded at all.
Where people get stuck
The library you install and the name you import are not always the same word. This trips up nearly everyone, at least once, in at least one library. When import something fails right after you installed it, that mismatch is the first thing to check — search for the library's own "getting started" page and read the first two lines of code exactly.
Writing a file and writing a document are different jobs. open() gives you plain text. If you want bold headings and paragraphs, you need a library that knows what a document is.
Your loop overwrites the same file twelve times. If you end up with one document instead of twelve, look at the filename inside your loop. It probably doesn't change.