from util.io import readvalue def fibonacci(n): if(n in (0,1)): return 1 return fibonacci(n - 1) + fibonacci(n - 2) if( __name__ == "__main__"): def nonnegative_int(s): i = int(s) if(i < 0): raise ValueError("{} is smaller than zero".format(i)) return i n = readvalue("n > ", nonnegative_int) print("fibonacci(", n, ") = ", fibonacci(n))