TORONTO KIDS COMPUTER CLUB | Monday 17:30 Python Practice – 22.10.24.
21318
post-template-default,single,single-post,postid-21318,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.8.0,vc_responsive

Monday 17:30 Python Practice – 22.10.24.

29 Oct Monday 17:30 Python Practice – 22.10.24.

Question:

The factorial function (symbol: !) says to multiply all whole numbers from our chosen number down to 1.

Examples:

  • 4! = 4 × 3 × 2 × 1 = 24
  • 7! = 7 × 6 × 5 × 4 × 3 × 2 × 1 = 5040
  • 1! = 1

Factorial is not defined for negative numbers, and the factorial of zero is one, 0! = 1

Write a function to find the factorial of a number. The function should take one number as an argument and print the factorial of that number

Sample Input: 
5

Sample Output:
120
Hint:
The factorial of 5 is 1 * 2 * 3 * 4 * 5 = 120 and also use loops inside the function
No Comments

Sorry, the comment form is closed at this time.