hi guys i have a proble to solve but i do not have a clue what the problem is asking me to do
i need some help.
i allready know this that a fibonacci sequence i generated by the fuction Fn=fn-1+Fn-2 but the problem says that i need to to build a program that out put F(2), F(5),F(7),F(13),and to use a loop.

I really need help I'm new at this and I do not have a clue of what the problem is asking; any help will be for sure appreciated
thanks

def fib(n):
    a, b = 0, 1
    for i in range(n):
        a, b = b, a + b
    return a

print fib(2)
print fib(5)
print fib(7)
print fib(13)

Are you looking for that loop?

Someone seems to give this out as a homework problem. Take a look at: http://www.daniweb.com/forums/thread90145.html

After the two starting values 0 and 1, each number is the sum of the two preceding numbers.

This is such an easy problem, I suggest you really try to understand it!

This is such an easy problem, I suggest you really try to understand it!

Also, a Google for "fibonacci python" has everything anyone could want. These posters are too lazy to ever make it as a programmer.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.