Funda swallow — the house mark in royal blueFundatryfunda.com
BetaUnder construction. Questions are being reviewed by teachers — enjoy the free practice in the meantime.

← All Computer Science

Python basics · Exercise

Factorial

Write a function factorial(n) that returns n factorial, written n!. 5! = 5 x 4 x 3 x 2 x 1 = 120. By definition, 0! = 1. Hint: Start with result = 1 and multiply it by every number from 2 up to n.

Funda swallow, in gold

Excellence or Nothing

Funda ZIMSEC is in review: every question is an original draft, checked by a Zimbabwean teacher before it counts. Funda is an independent study product and is not affiliated with ZIMSEC.