Level 2 β Functions & Data Collections β Functions, lists, strings, dicts, and comprehensions.
Define reusable functions with parameters and return values to eliminate repetition.
def grade_report(score):
if score >= 90: return "A"
elif score >= 80: return "B"
return "F"
print(grade_report(95))Functions are your code factories β write once, call anywhere. They reduce duplication and make code testable.
Complete all tiers to earn up to 2,850 XP and unlock the next chapter.