Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
Loading…
Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
Loading…
Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
PYTHON TEXT / CHAPTER 03 / Learn / LESSON 09
Ninth class — Text capstone. You combine string cleaning, joining, and counting in a loop.
Typical flow: walk entries, strip() into a clean list, count the rows you care about, build a short f-string message, and print the results.
Mini example:
lines = [" ok ", "ok"]
clean = []
for line in lines:
clean.append(line.strip())
n = 0
for line in clean:
if line == "ok":
n = n + 1
print(len(clean))
print("-".join(clean))
print(f"ok: {n}")This is the spirit of a small diary analyzer: raw lines → clean → count → report. We do not introduce new constructions — only combine what you already learned.
Capstone: cleaning, join, counting, and an f-string together.
DATA LAUNCH STANDBY
›