WJEC GCSE & A-Level · Made for Wales

Computer Science, made simple.

Lessons, revision and a live Python lab, mapped to every topic in the WJEC specification. Teachers prep less. Students understand more.

Written by a WJEC Computer Science teacher with 25+ years in the classroom.

Challenge 6 · Factorial4 tests

Write a function factorial(n) that returns n! (for example, 5! = 5 × 4 × 3 × 2 × 1 = 120).

Press Run to check your answer.
factorial(0)factorial(1)factorial(5)factorial(7)
0 of 6 done

Pick your course

Every topic in the WJEC specification, in order. Each square is a topic, and fills in as you complete it.

Low-cost, billed once a year

Start free. Upgrade when it helps.