Le Tuesday 24 June 2008 14:47:29 Danny Laya, vous avez écrit :
> Hi all, can you explain me what this code mean :
>
> Fibonacci.py
>
> # This program calculates the Fibonacci sequence
> a = 0
> b = 1
> count = 0
> max_count = 20
> while count < max_count:
>     count = count + 1
>     # we need to keep track of a since we change it
>     old_a = a
>     old_b = b
>     a = old_b
>     b = old_a + old_b
>     # Notice that the , at the end of a print statement keeps it
>     # from switching to a new line
>     print old_a,
>
>
>  Output:
>
> 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181
>
> Do you understand it ??? Can you explain me....ahhh.... you know
> i'm a newbie so please explain it with a simple expalanation.

see http://en.wikipedia.org/wiki/Fibonacci_number

> And I got many tutorial with title *.py(e.g: Fibonacci.py and Password.py),
> can you explain me what *.py mean? Thank's for helping me.

.py is just the extension for python source files, so you're supposed to copy 
the example in a file called Fibonacci.py and run it with

python Fibonacci.py

but of course you can choose any name you want for it.

-- 
Cédric Lucantis
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to