title: How to find the nearest Fibonacci Series number?
body: <p>My next step is if the input is not in the Fibonacci Series, the program has to give an output with a number which is in the series that is nearest to the input. I do not know how to proceed, can anyone help me?</p>
  
  <pre><code>def fibs():
      a,b = 0,1
      yield a
      yield b
      while True:
          a,b = b,a+b
          yield b
  
  n = int(input("please, enter a number: "))
  for fib in fibs():
      if n == fib:
          print("Yes! Your number is a Fibonacci number!")
          break
      if fib &gt; n:
          print("No! Your number is not a Fibonacci number!")
          break
  </code></pre>