00:01
This question asks us to write a python program to find the factorial of 5 with the output.
00:06
So to find the factorial, right, essentially what we're going to do is i'll make this applicable to any number n, right? so what we're going to do is we can have a 4 loop in python, so 4i in range.
00:23
And factorial is essentially, let's take into consideration 5.
00:27
5 factorial is equal to 5 times 4 times 3 times 2.
00:31
Times 1.
00:34
So with that in mind, what this essentially tells us is we're going to go from i in range 1 all the way to n, or n plus 1, so that we can include 5.
00:48
And for each of those, what we're going to do is we're going to add to our factorial count, factorial, or sorry, we're not going to add, we're going to increment by multiplication by i.
01:01
So what this does is we can start with factorial equals 1 and we have to start with factorial equals 1 because 0 factorial is equal to 1 so if we have 0 here we won't even enter the range over enter the range from 1 to 1 which should simply still stay 1 not start at 0 so factorial will start at 0 we'll go from 1 to n plus 1 each of those levels we're going to times equals by i then once we have that if we print out factorial, but it should give us the proper factorial.
01:35
So here, let's say, let's try plugging in 5 plus 5, right? we do 5 plus 1...