Need to find the Fibonacci series up to N terms.
n=int(input("Enter the n terms: "))
f_val=0
fib_list=[f_val:=f_val + i for i in range(n)]
print(fib_list)
While executing the above program, I got the result:
Enter the n terms: 5
[0, 1, 3, 6, 10]
My doubt is: what is the purpose of f_val := f_val + i
? I really don't know the purpose of :=
in Python. Can anyone help me to find the solution?