Unit 4 Tasks

Learn to code with step-by-step lessons. A place for students to work through programming fundamentals and build skills.

Unit 4 tasks

These problems follow 4.1 Defining functions and 4.2 Scope and return values. Use def, parameters, and return (and local variables) instead of one long script. You can still use input, loops, and lists where it helps.

Lessons: 4.1 Defining functions · 4.2 Scope and return values

Navigation

Tutorials: Tutorial 4.1 · Tutorial 4.2


Warm-up - def, parameters, and print

Returning numbers

Booleans and decisions

Loops inside functions

Putting it together


Solutions: e.g. Task 1 solution.