davidawad
8/15/2014 - 3:21 AM

Solution to the Is Fibo Challenge on Hackerrank in Python

Solution to the Is Fibo Challenge on Hackerrank in Python

I'll make this later##

====enjoy====

def fib(n):
    if n==0:
        return 0
    if n==1 or n==2:
        return 1
    return fib(n-1)+fib(n-2)

cases = int(input())
for i in range(0,cases):
    curr = int(input())
    j=0
    while int(fib(j)) < 10**10 :
        ##print('while ran '+str(j)+' time(s)')
        ##print('fib(j) is '+str(fib(j)) +' at this time' )
        ##print('curr is '+str(curr) +' at this time' )
        if curr == fib(j):
            print('IsFibo')
            break
        if curr < fib(j):
            print('IsNotFibo')
            break
        j+=1
    i+=1