We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
defisFibo(n):test_1=5*(n**2)+4test_2=5*(n**2)-4# If n is a fibonacci number then test_1 or test_2 must be a perfect squareifint(math.sqrt(test_1))**2==test_1orint(math.sqrt(test_2))**2==test_2:return'IsFibo'else:return'IsNotFibo'
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Is Fibo
You are viewing a single comment's thread. Return to all comments →
Python3: