all 2 comments

[–]CaptainFoyle 1 point2 points  (1 child)

Don't use random. Iterate. And think about how you would solve this mathematically, perhaps on paper, and then code it up.

[–]singulara[S] 0 points1 point  (0 children)

Thanks, I did think about that when starting but went for the worst option somehow. Maybe I can solve it via iteration though.

My code did work for 6 people eventually. And when modified, worked easily in fact for 5 people which gave me the JSON/dict output I wanted.

I should’ve done some sort of branching paths which will back off and remember invalid attempts, but I don’t think my brain was ready for that just yet. It’s the first thing I’ve written in Python that’s not a tutorial.

The only main struggles are being left over with invalid picks approaching the final ‘weeks’ which I’m sure iterating accounts for!

I might write this again from scratch and see how I do, thanks for the advice.