This code calculates, from a list of integers, the next fibonacci number for each integer. It does this for the first 60 numbers in the sequence. Any pointers on improving computing time, code readability, etc. are what I'm looking for.
def getFib(limit): a = 1 b = 1 res = [a, b] for i in range(1, limit): temp = a a = b b = temp + b res.append(b) return res def nextFibonacci(fib, n): for x in n: if x < 1 or x > fib[len(fib)-1]: print("Value is out of range.") else: temp = x for c in fib: if c > temp: temp = c break print(temp) def main(): listMe = [1, 9, 22] fib = getFib(60) nextFibonacci(fib, listMe) if __name__ == "__main__": main()