PS3 Problem1 Kind of a report here. But since original post is few days old im not sure how ppl will see it and reply. So anyways,i need some feedback here.How does this look? http://dpaste.com/569646/ im also quite confused how to do it the other way.
typos lol. repost** , how many**
the code looks fine to me :).. and about the other one...u have to try to write a function which will call itself in its definition.... and that will make it a recursive one.. basically the idea is in ur function u return y so function(target,key) returns y.. in iteration u replace y as y=1+y in recursion u have to do it as function(target,key)=1+function(shorter target,key).. this will increase ur count.. and if u never find any thing..u can return 0 this is the logic..now u may interpret into code :) best of luck :D
and yes replacing the 'into in (print key,' found ',y,' times into ',target' ) by in will be a good idea..i think :)
works and I think code is fine as well. a couple of suggestions.. 1) It helps (me at least :) if when you post code to check you include the run part well. Saves typing :) 2) As someone pointed out to me a few days ago it is a good idea to get in the habit of "returning" out of functions rather than just printing. Later you will be linking a whole bunch of functions like this together and depending on them to return values to each other. It can get very messy trying to track down where the mysterious "None" is coming from or why you aren't getting the right value at the end if you don't get return down. Like this: http://dpaste.com/569662/
yea i spent like 10 minutes today to figure out where the None was coming inmy ps5 problem...so u should follow blackarrow's suggestion instead :)
Join our real-time social learning platform and learn together with your friends!