Number Guessing Game - Random fails in tests

Hi! Thanks for your answer!
I’ve changed the script to only count for valid numbers (I put line 14 into line 20 from, but it still passes random tasks. It was my first try, but then I followed this solution..
What seems odd to me is that all tasks pass at least one test.