Posts

Fibonacci series in python

Image
Fibonacci Series Fibonacci series is 0,1,1,2,3,5,8,13,21,34,............,infinity . It is a sequence of number which follow some type of algorithm the alogrithm is  let  i = index position  a = it is a array of number  so to find a[i+1] = a[i]+a[i-1]. Note : fibonacci series always start with 0 and 1 and goes upto infinity.you can't start with your own values. Explanation: 1. 0 and 1 in starting is default values  2. if we go further the algorithm start adding previous 2 value and the answer is the next value.     as you can see the previous two value is 0 and 1 after adding both we get 1 as our 3rd value.     after that adding 1 and 1 we get our 4th value as 2 this entire cycle goes like this only. i think you get better understanding about fibonacci series we move further on coding of fibo  in python: Flowchart: coding: without recursion function: def fibonacci(n):      a = 0      b = 1 ...

Python Tutorial|Lambda Expression

* Lambda Expression * What is Lambda Expression? :-    In python we can define function in 2 ways 1. def  Keyword Using :-     This Type of Function De fination we  always Use In Python. This Function  Name We Define  Properly So it is Simple to Understand That.   def double(x): return x * 2 2. Lambda Keyword Using :-      In Python, anonymous function is a   function   that is defined without any name .    While normal functions are defined using the  def  keyword, in Python     anonymous functions are defined using the  lambda   keyword.   Hence, anonymous functions are also called lambda functions .    Syntax of Lambda Function in python lambda arguments: expression Why Lambda Function Is Better Than Instead def Function ? : - Just Because The Lambda Expression provide some benefit below as follow :- ...