Ejercicios de clase:

FACTORIAL
--------------------
n = input ("Que valor quieres calcular el factorial: ")

res = 1

for y in range (1, n+1):
  res = res * y
print res

NUMERO PERFECTO
--------------------------------

'''
Created on Aug 30, 2011

@author: iescobar
'''

#the perfect number

#get the number to check

theNum= input ("Please enter a number to check: ")

#find and sum up the divisors

divisor = 1
sumOfDivisors= 0

while divisor < theNum:
    if theNum % divisor==0:
        sumOfDivisors= sumOfDivisors + divisor
    divisor= divisor + 1
    
#classify the result

if theNum==sumOfDivisors:
    print theNum, "is a perfect Number"
elif sumOfDivisors < theNum:
    print theNum, "is deficient"
else:
    print theNum, "is abundant"