Hi! I'm stuck with my python homework and I have some troubles with it. Any help is very appreciated. Thanks!
1.
2.
сапріс сатрас Fibonacci numbers: 0, 1, 1, 2, 3 The 5th Fibonacci number is 5 The 15th Fibonacci number is 610 The 10th Fibonacci number is 55 Main Program (write the Fibonacci class. The rest of the main program will be provided. In the online judge, the main problem will be automatically executed. You only need the Fibonacci class.) Fibonacci class: In [1]: 1 main program: In [2] : 1 n = int(input()) 2 3 a = Fibonacci(0) 4 b = Fibonacci(1) 5 c = Fibonacci (2) 6 d = Fibonacci(B) 7 e = Fibonacci (4) 8 9 print(f 'Fibonacci numbers: {a}, {b}, {c}, {d}, {e}') 10 11 f Fibonacci (5) 12 print(f"The 5th Fibonacci number is {f.value}') 13 14 g Fibonacci (15) 15 print(f'The 15th Fibonacci number is {g.value()}') 16 17 print(f The {n}th Fibonacci number is {Fibonacci(n)}) 10 Fibonacci numbers: 0, 1, 1, 2, 3 The 5th Fibonacci number is 5 The 15th Fibonacci number is 610 The 10th Fibonacci number is 55
сапріс сатрас Fibonacci numbers: 0, 1, 1, 2, 3 The 5th Fibonacci number is 5 The 15th Fibonacci number is 610 The 10th Fibonacci number is 55 Main Program (write the Fibonacci class. The rest of the main program will be provided. In the online judge, the main problem will be automatically executed. You only need the Fibonacci class.) Fibonacci class: In [1]: 1 main program: In [2] : 1 n = int(input()) 2 3 a = Fibonacci(0) 4 b = Fibonacci(1) 5 c = Fibonacci (2) 6 d = Fibonacci(B) 7 e = Fibonacci (4) 8 9 print(f 'Fibonacci numbers: {a}, {b}, {c}, {d}, {e}') 10 11 f Fibonacci (5) 12 print(f"The 5th Fibonacci number is {f.value}') 13 14 g Fibonacci (15) 15 print(f'The 15th Fibonacci number is {g.value()}') 16 17 print(f The {n}th Fibonacci number is {Fibonacci(n)}) 10 Fibonacci numbers: 0, 1, 1, 2, 3 The 5th Fibonacci number is 5 The 15th Fibonacci number is 610 The 10th Fibonacci number is 55
сапріс сатрас Fibonacci numbers: 0, 1, 1, 2, 3 The 5th Fibonacci number is 5 The 15th Fibonacci number is 610 The 10th Fibonacci number is 55 Main Program (write the Fibonacci class. The rest of the main program will be provided. In the online judge, the main problem will be automatically executed. You only need the Fibonacci class.) Fibonacci class: In [1]: 1 main program: In [2] : 1 n = int(input()) 2 3 a = Fibonacci(0) 4 b = Fibonacci(1) 5 c = Fibonacci (2) 6 d = Fibonacci(B) 7 e = Fibonacci (4) 8 9 print(f 'Fibonacci numbers: {a}, {b}, {c}, {d}, {e}') 10 11 f Fibonacci (5) 12 print(f"The 5th Fibonacci number is {f.value}') 13 14 g Fibonacci (15) 15 print(f'The 15th Fibonacci number is {g.value()}') 16 17 print(f The {n}th Fibonacci number is {Fibonacci(n)}) 10 Fibonacci numbers: 0, 1, 1, 2, 3 The 5th Fibonacci number is 5 The 15th Fibonacci number is 610 The 10th Fibonacci number is 55
Hi! I'm stuck with my python homework and I have some troubles with it. Any help is very appreciated. Thanks! 1. 2.
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am