May-09-2018, 06:55 AM
In error you get, is an information, that you tried to give "d" in a command line, and convert it to an integer. That, of course, can't work. Maybe would be some idea to make some small check what you get in raw_input. You can do it using "isdigit" method. as you can see below, it returns true when they are only numbers in the string. Btw. you should think about checking the length of "length" because some truly huge number can crash your code.
x = '123' x.isdigit() True y = 'as' y.isdigit() False xyz = '1.123' xyz.isdigit() False xneg = '-5' xneg.isdigit() False