How to program factorial in Python?

label Computer Science
account_circle Unassigned
schedule 1 Day
account_balance_wallet $5

I don't get it :(((
Nov 22nd, 2014

# Python program to find the

# factorial of a number

# provided by the user

# take input from the user

num = int(input("Enter a number: "))

factorial = 1

# check if the number is negative, positive or zero

if num < 0:

  print("Sorry, factorial does not exist for negative numbers")

elif num == 0:

  print("The factorial of 0 is 1")


  for i in range(1,num + 1):

  factorial = factorial*i

  print("The factorial of",num,"is",factorial)


Nov 22nd, 2014

Studypool's Notebank makes it easy to buy and sell old notes, study guides, reviews, etc.
Click to visit
The Notebank
Nov 22nd, 2014
Nov 22nd, 2014
Jun 26th, 2017
Mark as Final Answer
Unmark as Final Answer
Final Answer

Secure Information

Content will be erased after question is completed.

Final Answer