+ 1

Print possible passwords with recursive function

Hello. I have to write a «recursive function» that prints the possible passwords of a lock to me. The password of this lock consists of four letters: a,o,u,i After the letter o, u or a can come. after u : o or i after a: u or o And after the letter i, neither of those three can be used. We take the «number of letters of password» and the «first letter» from the user as input And we have to print all the possible outputs. Can anyone solve it? Example: input: 5 o Output: oaoau oaoao oaoui oaouo oauoa oauou ouoao ouoau ououi ououo Example 2: Input: 6 i Output: 0

6th May 2021, 8:59 PM
Marjaf
Marjaf - avatar
8 odpowiedzi
+ 1
YUGRAJ thank you soooo much. that was perfect. I changed your code a bit and it finally looks like this: Thanks again https://code.sololearn.com/c430orK6t07p/?ref=app
7th May 2021, 7:31 PM
Marjaf
Marjaf - avatar
+ 1
Aysha I'm sorry. I really do not know the return function, otherwise I would not have discussed it here.
6th May 2021, 9:06 PM
Marjaf
Marjaf - avatar
6th May 2021, 9:46 PM
YUGRAJ
+ 1
Here what I tried is it correct?
6th May 2021, 9:46 PM
YUGRAJ
+ 1
Aysha thanks☺️
7th May 2021, 7:33 PM
Marjaf
Marjaf - avatar
+ 1
Yeah nice😀😀
7th May 2021, 7:36 PM
YUGRAJ