Meghwantsingh / Hacktoberfest2023

Start Learn with fun and be the Winner and Have a Good Day
https://hacktoberfest.com/
8 stars 24 forks source link

Added Fibonacci Series code in Python #46

Closed kirtisaraf247 closed 2 years ago

kirtisaraf247 commented 2 years ago

Merge it sir @Meghwantsingh

kirtisaraf247 commented 2 years ago

merge #46 please @Meghwantsingh

Meghwantsingh commented 2 years ago

merge #46 please @Meghwantsingh

Hello, could you pls comment the lines of code.

kirtisaraf247 commented 2 years ago

yes

merge #46 please @Meghwantsingh

Hello, could you pls comment the lines of code.

Yes sure, code--- def fib(n) :
if n==0:
return 0
elif n ==1 :
return 1
else :
return fib(n-1) +fib(n-2)
num = int(input("Enter a number: "))
print("The {num} element of fibonacci series is: ".format(num), fib(7))

Meghwantsingh commented 2 years ago

I know python is easy to understand just like English, but still could you explain the while loop why are you using it and for what. This one RecursionPython/MergeSort.py. Good day.