Sorting each new arrival into the bin labeled with its true category, based on reading off its measurable features first.
Features are the individual pieces of information describing something (legs, sound, habitat), and a label is the category assigned based on those features. Classification is deciding a label from features - real ML learns the rules for this from data; here, we write the rules by hand.
if feature1 == value1 and feature2 == value2:
label = ...legs = 8
if legs == 8:
label = "spider"
elif legs == 4:
label = "mammal or reptile"
else:
label = "unknown"
print(label)legs is the FEATURE - one piece of information about the creature. Based on that single feature, the program assigns a LABEL - the category "spider" - the same core idea a real image classifier uses, just with far more features and learned rules instead of hand-written ones.
legs = 2
sound = "quack"
if legs == 2 and sound == "quack":
label = "duck"
elif legs == 4:
label = "mammal or reptile"
else:
label = "unknown"
print(label)This time TWO features (legs AND sound) combine to reach a more specific label - real classification almost always uses many features together, not just one.
In the app this lesson continues with the animated explanation, spoken aloud, and then the practice: Classify: if legs == 6 and habitat == "hive", label = "bee". elif legs == 8, label = "spider". else, label = "unknown". Print the label for legs = 6, habitat = "hive". The editor runs your child’s real code and checks the result, with their coding buddy reacting to what they wrote.
Try it free