As stated here isdigit()
is a string method. You cannot call this method for integers.
This line,
cpi = eval(input("Enter the CPI for July 2015: "))
evaluates
user input in integer.
>>> x = eval(input("something: "))
something: 34
>>> type(x)
<class 'int'>
>>> x.isdigit()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'int' object has no attribute 'isdigit'
But if you delete the method eval
(you better do it),
>>> x = input("something: ")
something: 54
>>> type(x)
<class 'str'>
>>> x.isdigit()
True
everything will be fine.
By the way, using eval without user sanitizin can cause problems.
consider this.
>>> x = eval(input("something: "))
something: __import__('os').listdir()
>>> x
['az.php', 'so', 'form.php', '.htaccess', 'action.php' ...