0

Can anyone help me figure this problem out in this simple python dice game?

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

19th Jul 2017, 6:24 PM
PacketStorm
PacketStorm - avatar
6 Respuestas
+ 5
Add "return " in lines 33 and 64. That should fix it.
19th Jul 2017, 8:34 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 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
19th Jul 2017, 8:52 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 2
wow that did work! I'm not entirely sure why but it did, thank you! can't believe I got help so quickly
19th Jul 2017, 8:45 PM
PacketStorm
PacketStorm - avatar
+ 1
And what is the problem???
19th Jul 2017, 6:31 PM
ΞⓀⒾⓃⒼΞ
ΞⓀⒾⓃⒼΞ - avatar
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
19th Jul 2017, 6:41 PM
PacketStorm
PacketStorm - avatar
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
19th Jul 2017, 10:10 PM
PacketStorm
PacketStorm - avatar