why does it print atm?.. i don't understand.. plz help
Why does what? Link to code on a paste service so we can look at it? Please do not just paste here unless you put ``` (the one that shares ~) above and below. The differences is this: for x in range(10) some loop stuff some more looping! ``` for x in range(10) some loop stuff some more looping! ``` Now copy and paste both of those.... The top will probably collapse on you.
def f(s): if len(s) <= 1: return s return f(f(s[1:])) + s[0] #Note double recursion print f('mat')
this is one of the quiz questions. quiz 1 , #3
Do you know that in recitation 5 the TA explained that problem? the video address for recitation 5 is http://www.archive.org/download/MIT6.00SCS11/MIT6_00SCS11_rec05_300k.mp4
f('mat') = ff('at') + 'm' f('at') = ff('t') + 'a' = 't' +'a' = 'ta' ff('at') = f('ta') = ff('a') + 't' = 'at' f('mat') = ff('at') + 'm' = 'at' + 'm' ='atm'
Join our real-time social learning platform and learn together with your friends!