0
Can anyone help me figure this problem out in this simple python dice game?
6 Réponses
+ 5
Add "return " in lines 33 and 64. That should fix it.
+ 5
If you want to make it recursive (to ignore unwanted return value) this is a proper syntax, as you have to call it to return itself again, until some other "return" command will exit the recursive loop.
I used a similar mechanism for a quick RNG challenge some time ago - it calls the same function recursively until it returns one of the allowed values only.
https://code.sololearn.com/cL80c4UsmFtX/?ref=app
+ 2
wow that did work! I'm not entirely sure why but it did, thank you! can't believe I got help so quickly
+ 1
And what is the problem???
0
it explains it in a comment on the code but it runs fine most of the time and then every once in a while the last few lines pick up a 'none' type, hard to explain without running it a few times
0
wow solo learn is the best I love this community, I don't have to pull my hair out for such a simple bug, and I learn something about recursive functions that I've been wondering for a while too! thanks so much