0 points

Iterative Approach to Solving Factorials


dashboard

Mon Sep 28 2020 19:57:11 GMT+0000 (UTC)

Posted by @Adorism80 #python

def getFactorialit (n):
	if n < 0, return -1
    else fact = 1
    for i in range (1, n +1):
    	fact *=i
    return fact
    
print getFactorialit(10)
    
content_copy Copy

I was learning about the difference between iterative and recursive problem-solving approaches in Python using a YouTube video to guide me.

https://youtu.be/wMNrSM5RFMc