#------------------------------------------------------------------------------ # Fibonacci2.py #------------------------------------------------------------------------------ def fib(n): """ recursive version of Fibonacci function returns the nth Fibonacci number, not the whole list """ if n==0: return 0 elif n==1: return 1 else: return fib(n-1)+fib(n-2) # end if-elif-else # end fib() # function main() ------------------------------------------------------------- def main(): n = int(input('Enter the index of a Fibonacci number: ')) print(fib(n)) # end main() # closing conditional --------------------------------------------------------- if __name__=='__main__': main() # end