L02 ยท T2 Week 1 ๐ŸŽฏ CT5-THI-01 ยท CT5-DPM-01 ๐Ÿ“‚ Phase 1 โ€” Python Refresher

Lesson 2: Loops + Functions (Faster Pace)

๐Ÿ“ L02 Loops + Functions โ€” Self-Check Handout Open โ†’
23 questions ยท 75 marks ยท 75 min target. Covers for/while loops, list comprehensions (NEW), functions, default parameters, *args (NEW), and scope. Same submit-and-score flow as L01.

Learning Intentions

Success Criteria

๐Ÿ“ Do Now โ€” Error of the Day

Predict the output: print([x*2 for x in range(5)]) โ€” what prints? (Hint: that's a list comprehension โ€” new to you.)

๐Ÿ‘ I Do โ€” Teacher Demo

Live-code: (1) quick for-loop refresh; (2) introduce list comprehension syntax; (3) define a function calculate_damage(hp, damage, armour) with return value; (4) show *args with total_score(*scores).

๐Ÿค We Do โ€” Build Together

Class types along: build a function count_alive(characters) that loops a list and counts those with hp > 0. Introduce scope by showing what happens if you try to read a local variable from outside.

๐Ÿš€ You Do โ€” Your Turn

Work through the arcade quests below. Mix of predict-output, typing drills, and code tasks. Aim for 8-12 quests this session.

  • List comprehension exercises (squares, evens, filter)
  • Function challenge: write calculate_damage(hp, damage, armour)
  • Write a function that returns multiple values using a tuple

๐ŸŽฎ Practice Quests โ€” work through these

Loading practice quests for this lesson...

Three tiers โ€” pick yours

Support

scaffolded functions with TODO in body

Core

standard

Extension

recursive challenges

Extensions

๐Ÿ“ Exit Ticket โ€” Coding Journal

Journal: write one 3-line function you wrote today + one line explaining what it does.

Evidence of Learning

Student solutions show working loops + functions. Can explain scope (variables inside functions are local).

โ† PreviousLesson L01โ†‘ HubAll LessonsNext โ†’Lesson L03