I have only just started working with Python and one of the exercises I got from my tutor is to convert a tuple (number of nested brackets) into decimals; I have been working on this for hours now, but I got nowhere... e.g. input = (((()))) output = 3
I started like this:
def add (x,y):
if y == '()':
return x
else:
length = len(y)
return successor(add (x,y[1:length-1]))
could anyone give me a hint where I´ve gone wrong - PLEASE!!!!