Imam velikih glavobolja sa 16. zadatkom na 64. strani:
Citat:
A Fibonacci sequence is a sequence of numbers where each successive number is the sum of the previous two. The classic Fibonacci sequence begins: 1, 1, 2, 3, 5, 8, 13, ... Write a program that computes the nth Fibonacci number where n is a value input bz the user. For example, if n = 6, then the result is 8
Zablokirao sam skroz, ne znam ni odakle da krenem...Uradio sam "sve ostalo", ali "glavno" mi fali.
Code:
# fibonacci.py
# Program that computes the nth Fibonacci number
# where n is avalue input by the user
def main():
print("Welcome to Fibonacci calculator!\n")
n = int(input("Enter n: "))
for i in range(1, n+1):
print(str(i) + "th Fibonacci number is: " + str(fibonacci))
print(str(n) + "th Fibonacci number is: " + str(fibonacci))
main()
# fibonacci.py
# Program that computes the nth Fibonacci number
# where n is avalue input by the user
def main():
print("Welcome to Fibonacci calculator!\n")
n = int(input("Enter n: "))
for i in range(1, n+1):
print(str(i) + "th Fibonacci number is: " + str(fibonacci))
print(str(n) + "th Fibonacci number is: " + str(fibonacci))
main()
Molio bih za pomoć pa da raskrstim s ovim trećim poglavljem već jednom...