Comparing by eye ends here. The simplest scorer is exact match: a case passes when what you got is exactly what you expected. It fits answers that come from a short, fixed list, like the four labels of the Corner Shop's assistant.
A failed case must explain itself: which case, what was expected, what came back. And a run needs a score, one number you can compare from run to run. This course writes it as a fraction and a rounded percent: 2 passes out of 3 cases is 2/3 (67%).
Exact match is strict: "Yes" == "yes" is False, and so is "yes " == "yes". So before two answers are compared, bring them to one form. That is normalizing. Two string methods do it:
" Yes ".strip() # "Yes": cuts the spaces and line breaks around the text
"YES".lower() # "yes": makes every letter small
Normalizing forgives the form of an answer, never its content. When the lesson is finished, your program must print the two real failures and the score:
FAIL c3: expected shipping, got refund FAIL c4: expected product, got refund Labels: 8/10 (80%)
The check also calls your two functions: normalize(" Other ") must give other, and score_text(2, 3) must give 2/3 (67%).
Your task: the cases and the loop that sets got are already there. Count the cases that pass, print a FAIL line for each one that doesn't, write score_text(passed, total) and print the score, then write normalize(text) and use it on got before the comparison.
Assignment
Follow the Coding Tutorial to score the ten cases by exact match, print the failures and the score, and normalize the answers first.
Hint
Numbers need str() before + can glue them to a string. round(100 * passed / total) gives the whole percent. Mind the spaces inside "FAIL ", ": expected " and ", got ".
Free plan: 30 tutor messages. PRO is unlimited.
