 Hi everyone. In this lesson, we're going to write function for Fibonacci series in Python programming language. Length of Fibonacci series will be given by user. First in first. What is Fibonacci series? Fibonacci series is a series whose first number is zero. Second number is one. And other numbers you will get by adding two previous numbers from that series. So for example, for the third member of series, two previous numbers are zero and one. So when we'll add zero plus one, we will get that the third member is one, because zero plus one is one. Then the fourth element is the sum of the two previous elements. Fourth element is a sum of one plus one, so fourth element is two. The fifth element is now sum of one plus two, which is three. The sixth element is sum of two plus three, which is five. The seventh element is the sum of two last elements, three and five. And that is eight. And list goes on. Now let's write function for Fibonacci series. Let's open new file. Okay, first we'll define function. Let's call it just Fib. And our function will have one argument. That argument will be the length of Fibonacci series. We'll use letter N for this argument. Now, if length of series is zero, then the result is zero. So if N is zero, if N is zero, we'll return zero as a result. Of course, you must notice that assignment operator in if statement will be with two equal signs. Next, if N is one, our function needs to return one as result. So we'll say if N equals one, then return one. Now, otherwise, if N is greater than one, then it will return the result of sum of last two arguments. So else we'll return sum of last two elements. We'll use recursion to call our function again. And as arguments, we'll put values of last two elements and they are N minus one and N minus two. So we'll be calling again our function Fib with arguments N minus one and with argument N minus two. And that is our function for Fibonacci series. Of course, there is other ways to write function if you go to the Python site. You can see this Fibonacci example of Fibonacci series. This version may be a little difficult for understanding for beginners. So I'm using this version, which is easy to understand. That's all for this video. Thanks for watching. Happy coding.