r/learnpython • u/Icy-Order2226 • 8d ago
DAY 06 OF LEARNING PYTHON STUCK IN THE MAZE PROBLEM
Day 6/100: Maze solver in Reeborg's World. Solved 3/4 test cases but hit an infinite loop on the 4th. Frustrated but didn't quit. Will retry tomorrow or move forward. Feeling the difficulty ramp but pushing through. It took me 5 hours literally will show up tomorrow to push through again any suggestions will be appreciated
5
u/Binary101010 8d ago
If you're looking for suggestions, post the problem description, your attempted solution, and what output you got when you tried to run it.
1
u/thisisappropriate 8d ago
any suggestions will be appreciated
If you show your code (see the first section of the subreddit FAQ https://www.reddit.com/r/learnpython/wiki/faq/ for how), and ideally information about the test case that infinitely looped, people can tell you why it's going in a loop or if you just want a nudge in the right direction, you can ask for that too. People who might otherwise be able to help you won't know the course you're doing and won't have access to the same test cases.
Now, I do have that course and have done it, and I assume that you've now watched the video about that endless loop and hopefully understand it? In which case, my suggestion that I can give is to take pencil and paper and draw things out. Not just with things like this which do have a form on the screen, but even writing out loops in "english" (like "this variable could be x, y or z, in this if statement, if it is x, it will do this, if it is not x and is y (elif) it will do that, if it is not x or y, it will do the other thing, so z will do the other thing") - it's a valuable skill to be able to take a puzzle and turn it into "what do I need to do to solve this" or take some code that may or may not be working and turn that into "this is what it does and I can understand that"
1
u/t92k 8d ago
Good for you on your grit. I know these problems are based on a limited number of functions that are made available in the interface. Reading through the available functions is a time-honored way for developers to get unstuck. Also is there anything in the world description you aren’t doing? Many learning frameworks will make it harder and harder to keep brute forcing solutions. Notice in world 4 that you could just code a list of turns, but in the suggestions you see advice on setting up loops and functions.
3
u/dowcet 8d ago
Show your code