Iteration for Factorials

Peter Goodman peter.goodman at gmail.com
Mon Oct 22 13:05:45 EDT 2007


On Oct 22, 8:26 am, Py-Fun <lorna.bu... at gmail.com> wrote:
> I'm stuck trying to write a function that generates a factorial of a
> number using iteration and not recursion.  Any simple ideas would be
> appreciated.

def fac_btt(num):
	total = 1
	if num > 1:
		for i in range(1, num+1):
			total *= i
	return total




More information about the Python-list mailing list