Skip to content

Instantly share code, notes, and snippets.

@Irvingutierrez
Created May 7, 2015 01:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Irvingutierrez/90b9805598d2668d68dd to your computer and use it in GitHub Desktop.
Save Irvingutierrez/90b9805598d2668d68dd to your computer and use it in GitHub Desktop.
WSQ09
print()
print()
print("This program is used to calculate de factorial number ")
print("of a positive integer")
print()
validacion=0
while validacion==0:
print("Introduce an integer number: ")
num=int(input())
def factorial_0 (a):
a=1
return a
def factorial_num (a,b):
while b>1:
b=b-1
a=a*b
return a
return b
if num==0:
factorial_cero= factorial_0(num)
print("The factorial number of 0 is: ", num)
else:
contador=num
factorial= factorial_num(num,contador)
print("The factorial number of ", num, " is: ", factorial)
validacion=3
while validacion==3:
print()
print("Do you want to try it again?(y/n)")
r=str(input())
print()
if r=="Y" or r== "y":
validacion = 0
elif r=="n" or r== "n":
print("Goodbye ;)")
validacion = 1
else:
print("Please enter a valid character")
validacion = 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment