Python Lab Ex 9

seeders: 0
leechers: 0
Added on April 19, 2015 by 3sgknightin Other > Tutorials
Torrent verified.



Python Lab Ex 9 (Size: 1.69 KB)
 L9.E1.py1.69 KB

Description

L9.2 Exercises
Exercise L9.E1 – The Fibonacci sequence is defined with an integer n as,
F(n) = F(n1)  F(n2)
for
n = 2, where F(0) = 0,F(1) = 1.
You have to develop a Python program to compute
F(n)
for a given integer
n
between 0 and 20.
Input:
0 < n < 20
Output:
F(n) < 2^32
Compute F(n) starting with n=2 and increment iteratively until the required value is obtained. Follow
the instructions below.

1. Create a text file named “FileIn.txt” containing the value of
n
. The text file needs to be saved
in the same folder where the source file has been saved.
2. Develop a Python function named “getNum” to read the number n from the file “FileIn.txt”.
3. Develop a Python function named “show” to display the given value n and the computed value
of F(n) on the screen.
4. Develop a Python function named “saveFile” to write what was displayed in (3) above to a
text file named “result.txt”. This file should be in the same folder where the source file is.
5. The program should call the appropriate functions to achieve the task.


Related Torrents

torrent name size seed leech

Sharing Widget


Download torrent
1.69 KB
seeders:0
leechers:0
Python Lab Ex 9