Feb-28-2019, 08:35 AM
Ooh I understand!!
It is working for a part. If I want the 2nd fibonacci number bigger than 4 it is giving 8. But if I give the 2nd bigger than 5 it gives also 8.
It is working for a part. If I want the 2nd fibonacci number bigger than 4 it is giving 8. But if I give the 2nd bigger than 5 it gives also 8.
position_in_fib_sequence = int(input("Which fibonaccinumber do you want to know?")) the_number_has_to_be_bigger_than = int(input("Bigger than?")) G1 = 0 G2 = 1 while G2 < the_number_has_to_be_bigger_than: G1, G2 = G2, G1 + G2 for i in range(position_in_fib_sequence-1): G1, G2 = G2, G1 + G2 print("The", str(position_in_fib_sequence) + "th", "fibonaccinumber bigger than", the_number_has_to_be_bigger_than, "is", G2)