+ 1

Error in my code

When I run the code and I write "n" so I stop adding names in my guest list, it runs twice or three times the function, instead of breaking the while loop inside the function. What am I doing wrong? https://code.sololearn.com/cq37hK6GfR9W/?ref=app

3rd Sep 2022, 4:38 PM
Andres Villarreal
Andres Villarreal - avatar
3 Answers
+ 2
You are using recursion. When you input y, you are calling invitations() a new call to function itself.. So if you input y 10 times then you will repeats this 10 times... What is your y input do there? and also before input q you have a call invitation() line34 and after input to q as 2 then again will produce more recursive calls.
3rd Sep 2022, 4:56 PM
Jayakrishna šŸ‡®šŸ‡³
3rd Sep 2022, 6:33 PM
Andres Villarreal
Andres Villarreal - avatar
0
Btw for some reason in solo learn doesn't work. Try testing the code in vs code or smth
3rd Sep 2022, 4:40 PM
Andres Villarreal
Andres Villarreal - avatar