I have the following code, but why it complains that 1 argument needed, I have given 2?
Runtime error line 22.
I don't even have 22 lines for this code.
# @return an integer
y = str(myNum)
newStr = ''
for digit in y: if digit == '-': newStr+='-' else: newStr+=y[-1:] y=y[:-1] return newStr
What language is this?
I expect the problem is that you put "y=y[:-1]" inside "for digit in y".
You must not modify the list of function arguments. In python, you need to pass 'self' as the first argument. i.e., reverse must take two arguments: self and myNum, in order to be properly called.
BTW, line 22 is not part of your code; it is in the testing code that comes after your code.