+ 2

Is my implementation of Recursion practical for the Producton Server ?

https://code.sololearn.com/cwEepgQakMd3/?ref=app

26th Nov 2021, 5:41 AM
Sanjay Kamath
Sanjay Kamath - avatar
3 Antworten
+ 3
Rik Wittkopp Sir, TEST is a RESERVED WORD 😈😈😈
26th Nov 2021, 4:28 PM
Sanjay Kamath
Sanjay Kamath - avatar
+ 2
Sanjay Kamath I tested your code. inputs test t result -> 0 This indicates your code is not functioning as required. PS: it is also not recursion because you are using a while loop. Remember that recursion needs a base case to exit the loop, so you must figure out how to create this base case. You must also inspect each letter of the word to see if it matches your chosen letter. This could be done with a slice It is also possible to remove letters of a string using pop() With these concepts in mind, yiu could create a recursive function that has a base case of len(word) ==0 You could then inspect each letter using word[slice], add your count if it matches, then remove, pop(slice) See if you can put it together
26th Nov 2021, 8:31 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
Rik Wittkopp Test data : are you welcome 1st line + Enter O 2nd line then submit Frankly the testcases pass without error in the return and Search exercises....don't know why ?..
26th Nov 2021, 2:22 PM
Sanjay Kamath
Sanjay Kamath - avatar