cs102 lab4
http://www.maths.nuigalway.ie/~gettrick/teach/cs102/labs/l4.html
-
For this lab you must submit all source code (python
files), and, if applicable, the result(s) of running the program on (a few)
test cases. This should be sent in via BLACKBOARD (not directly by email).
The source code must
be well presented (indenting, spaces, reasonable variable/function names,
etc.) and must include comments (as a rough guideline - aim to have nearly as
many comments as lines of code). Any questions asked should be answered by
typing the answers into the relevant box on the BLACKBOARD upload form.
-
This material should be uploaded
before
the deadline of 5pm
Friday February 17th, 2012. You will lose 20% for each day
(or part of day) the lab is late.
-
Plagiarism (the unattributed copying of work from other sources
(internet, fellow students,....)) will not be tolerated. Please see
http://www.nuigalway.ie/engineering/documents/plagiarism_guide_students
_v4.pdf. You risk getting zero for your lab if it is found to be
plagiarized.
The Fibonacci Numbers (or sequence)
are defined by setting the first two
numbers equal to one, and each successive number equal to the
addition (sum) of the previous two numbers. In other words,
f1=1, f2=1,
fi= fi-1+fi-2,
so we get the sequence 1, 1, 2, 3, 5, 8, 13, 21,....
Write a program in PYTHON to calculate the nth
Fibonacci Number, using
-
Iteration
-
Recursion
(You should submit your two programs as separate attachments in the
BLACKBOARD upload page).
©
NUI, Galway