Pseudocode & Sub-skills
beginner12 min readLesson 48 of 169
Plain-language programs, plus counting, searching, aggregating, transforming.
Pseudocode: the program in plain language
total = 0
for each price in prices:
if price > 100:
total = total + price * 0.9
else:
total = total + price
print total
No syntax to trip on; just the logic. Translate to Python afterwards, one line at a time. If you cannot write the pseudocode, you do not understand the problem yet โ no amount of Python will fix that.
The classic sub-skills
- Counting: a variable that goes up by one when something happens.
- Searching: loop until found, remember WHERE, stop looking (or don't โ count all matches instead).
- Aggregating: total, average, best, worst โ the accumulator family.
- Transforming: build a NEW list from an old one, item by item.
Every challenge below is one of these wearing a costume.