Day 17
1 def generateFibonacci():
2 count = int(input("How many fibonacci numbers would you like to generate? "))
3 i = 1
4 if count == 0:
5 fib = []
6 elif count == 1:
7 fib = [1]
8 elif count == 2:
9 fib = [1,1]
10 elif count > 2:
11 fib = [1,1]
12 while i < (count - 1):
13 fib.append(fib[i] + fib[i-1])
14 i += 1
15 return fib
Write out what the code does line-by-line
Example:
Line 1: Define a function named generateFibonacci() that takes in no parameters.
Line 2: blah blah blah
favorite_languages = {
'john': 'Python',
'irene': 'C',
'yukio': 'Python',
'charles': 'Java',
}