Putting it all together
You have all the building blocks of a first real program: variables, conditions, loops, functions. Let's assemble a working tool out of them — a currency converter with a fee. The task sounds grown-up: convert a list of ruble amounts into dollars, apply the exchange fee, report on each operation, and print the total.
First look at the finished solution and read it top to bottom — reading code before writing your own speeds up learning many times over:
Recognize all the course elements? Settings in variables up top, the calculation packaged in a function, an accumulator loop iterating over the orders, a condition at the end making a decision. That's what almost any script looks like — from a converter to the balance monitoring from the AI course case study.
How a program is built: the order of thinking
A beginner sits down to write code. An expert first lays out the task:
- What's the input? A list of amounts, the rate, the fee.
- What's the output? A line per operation + a total + a warning.
- What are the steps between them? Convert one amount (function) → repeat for all (loop) → accumulate the total (accumulator) → check the threshold (condition).
- Now the code — the steps are already laid out, all that's left is to translate them into the language.
This is the same decomposition skill as in setting tasks for AI (the prompting module): a big task → a sequence of small ones.
Improve the program
A program never ends at its first version. Practice on the finished base — make changes one at a time, running after each:
- add a count of the number of operations and print it in the total;
- the exchange fee drops to 1% for amounts of 50,000 rub. and up — account for it in
convert(a condition inside the function); - add a list of suspiciously small operations (under 500 rub.) and print them separately.
Each of these improvements is small but requires understanding the existing code and fitting into it. That's everyday programming.
Key takeaways
- A real script = settings + functions + accumulator loop + conditions. You already know the blocks.
- The order of thinking: input → output → steps between them → only then code.
- Decomposing a task is the same skill as in prompting.
- A program evolves in iterations: change → run → check.