pep style and fixed exception on input other and integer type

This commit is contained in:
Akshay Sharma 2016-09-26 16:08:40 +05:30
parent 7c90322815
commit a3c5167fad

View File

@ -1,10 +1,12 @@
"""
This is a pure Python implementation of Dynamic Programming solution to the fibonacci sequence problem.
"""
class Fibonacci:
class Fibonacci:
def __init__(self, N=None):
if N:
N = int(N)
self.fib_array = [0] * (N + 1)
self.fib_array[0] = 0
self.fib_array[1] = 1
@ -43,6 +45,7 @@ if __name__ == '__main__':
"\n********* Enter different values to get the corresponding fibonacci sequence, enter any negative number to exit. ************\n")
while True:
print("Enter value: ", end=" ")
try:
i = eval(input())
if i < 0:
print("\n********* Good Bye!! ************\n")