TORONTO KIDS COMPUTER CLUB | Aurora Tuesday 10:30 Python Homework 21.07.13.
19715
post-template-default,single,single-post,postid-19715,single-format-standard,ajax_fade,page_not_loaded,,no_animation_on_touch,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.10.0,vc_responsive

Aurora Tuesday 10:30 Python Homework 21.07.13.

16 Jul Aurora Tuesday 10:30 Python Homework 21.07.13.

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

Class review:

No Comments

Sorry, the comment form is closed at this time.