Question about fixing infinite loops in my first Python project
I was working on a simple Python script to track inventory (kind of like my warehouse job, but just for practice). I set up a while loop to keep asking for input until the user typed 'quit', but it just kept running forever. I couldn't figure out why (my code looked right to me, you know?). After staring at it for an hour, I decided to add some print statements to see what was happening. Turns out, I was comparing strings without stripping whitespace, so 'quit ' with a space didn't match my condition. I used the .strip() method, and it worked perfectly. Now I always clean up user input first, and I think a lot of beginners run into similar issues with data types and comparisons.