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 FUNCTIONS / CHAPTER 04 / Learn / LESSON 09
Ninth class — capstone. Process a list of records: valid and invalid. Use small helpers + try/except.
Idea: for each record try to compute BMI (or a similar metric). On ValueError increase a fail counter. On success — print the result and increase ok.
You combine: small functions, checks, raise/catch, a loop. That is real batch style.
Common mistake: one huge try around the whole loop (you lose which rows passed); or stopping on the first error when the task wants to count all.
Capstone: small helpers + try/except over valid and invalid records.
DATA LAUNCH STANDBY
›