Print possible passwords with recursive function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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 Answers
+ 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
+ 4
Kindly try to show your efforts. So that we can help you.
6th May 2021, 9:03 PM
Aysha
Aysha - avatar
+ 4
Marjaf no need to say sorry it's ok to ask help. Surely you will get the desired the answer.
7th May 2021, 6:56 AM
Aysha
Aysha - 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