Iterative Approach to Solving Factorials

PHOTO EMBED

Mon Sep 28 2020 19:57:11 GMT+0000 (Coordinated Universal Time)

Saved 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_copyCOPY

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