But what if your startValue is not 0 and 1, your start value can be any term.. We can then use it as a variable but how to then print it out? I am stuck with this for about 3 days now.
A Fibonacci Sequence almost always starts with 0 as to reach other numbers(such as 8:0,1,1,2,3,5,8) If your starting number is not 0, and starts with x(as long as x is another number in the Fibonacci Sequence),then label n1 as x,and n2 as the number that comes after x in the Fibonacci Sequence.
Num = int(input("Enter no. of terms - ")) if Num < 0: print("Enter a value greater than 0!") if Num > 0: a = int(input("Enter a number from the Fibonacci Sequence : ")) b = int(input("Enter a number succeeding the first no. :")) c= 0 for x in range(Num): print(c,end=" ") c = a + b a = b b= c
range (0, num) helps to generate sequence of number from 0 to n.. eg. range (0,5) will give 0, 1,2,3,4 .. in next print statement.. end parameters defines what to print after number ..In this example end=" " will add blank space after printing sum. Hope this helps.
Hi, You can pass n in defined parameters and use recursive approach or use loop and sum the fibonaccies. and return final sum. Hope this overview helps you.
One day before exam watching this 😅
Hope it helps you in understanding. All the best for your exam.
i 2 days before😅✌️😇
Aktu ?@@pawansingh_1000
I am also before one day of exam.😅😂
Same day 🤡
Wow amazing job explaining this concept, I was literally struggling for hours till I watched your videos. Thank you thank you thank you….
Same, this was very informative and helpful
his english is very wonderful
Clear explanation!
Can we do it using while loop?
But what if your startValue is not 0 and 1, your start value can be any term.. We can then use it as a variable but how to then print it out? I am stuck with this for about 3 days now.
A Fibonacci Sequence almost always starts with 0 as to reach other numbers(such as 8:0,1,1,2,3,5,8)
If your starting number is not 0, and starts with x(as long as x is another number in the Fibonacci Sequence),then label n1 as x,and n2 as the number that comes after x in the Fibonacci Sequence.
Same code but with user input
Num = int(input("Enter no. of terms - "))
if Num < 0:
print("Enter a value greater than 0!")
if Num > 0:
a = int(input("Enter a number from the Fibonacci Sequence : "))
b = int(input("Enter a number succeeding the first no. :"))
c= 0
for x in range(Num):
print(c,end=" ")
c = a + b
a = b
b= c
Plz do more videos like this in python topic this is bca students request
brilliant explanation
nicely explained.. thanks
Thank you so much Sir!
Glad it helped you.
Sir plz tell where are you writing this code???? Which where on idle?
Hi, this code is written in Pycharm IDE which is freely available on their site.
@@TheProgrammingPortal tysm
makasih bang the programming portal aku tadi disuruh menulis beginian ama guruku tetapi saat kau muncul di beranda ku aku tertolong sekali
Great video
This was a great video!
Hi man, welcome to you.
First equal to should be==like
sir why didn't we took n+1 cause 7 will not be taken in range
Hi, n+1 not taken as we need to print upto n terms, and we started with 0.
Eg. Print 7 fibo series, start with 0 to 6
@@TheProgrammingPortal thanks sir
Sir I will print some range by using forloop it will not print
Hi, are you trying to run the same code explained in the video? Can you check the code once and share the error
4 Hrs before the exam watching this😂
it is great
Watching this video before 2 hours of exam
It's hard
Our teacher took 2 hours to do this 😅
Todays exam me watching before exam😅
Smart guy!!!!
sir i have difficulty in line 7
what is meanung of range
(0 , end " ")
range (0, num) helps to generate sequence of number from 0 to n.. eg. range (0,5) will give 0, 1,2,3,4 .. in next print statement.. end parameters defines what to print after number ..In this example end=" " will add blank space after printing sum.
Hope this helps.
App name please
thanks alot
🤩🤩
What is the logic of this code
To print the Fibonacci Sequence,duhhhh....
@@king_speedyamv8498 🤦♂️
How do i do it for nth position after taking n number?
Hi,
You can pass n in defined parameters and use recursive approach or use loop and sum the fibonaccies.
and return final sum.
Hope this overview helps you.
Hi sir should I subscribe to you???? Explain.
Hi
Tomorrow's my ai exam
Syntax error aa rha hai
What syntax error are you getting? Please validate the code once. Also, check any indention error or something else.
n=int(input("enter your number")
X=0
Y=1
Z=0
For i in range(n):
x+y
y+z
Z=x+y
Print (z)
Run
n=int(input("enter your number"))
x=0
y=1
z=0
for i in range(n):
print(z)
x=y
y=z
z=x+y
did not work