I'm doing the problem described here:
I understand the code has this error in python 3:
File "main.py", line 3, in <module>
Test.assert_equals(seven (1603), (7, 2))
File "/home/codewarrior/solution.py", line 7, in seven
newM = int(s[:(len(s)-1)]);
ValueError: invalid literal for int() with base 10: '-'
Where/Why is their a difference in evaluation?
def seven(m):
count=0;
while(m/100 != 0):
s = str(m);
lastdigit = int(s[len(s)-1]);
if(len(s)>1):
newM = int(s[:(len(s)-1)]);
count+=1;
m = newM - 2*lastdigit;
return (m,count);