Your "AI Pair Programmer" built a music sorting app. It looks great, but it logic is...chaotic. Songs disappear, everything gets sorted as "Hype", and the "Lucky" button crashes the app.
Your Mission: Use an AI chatbot to investigate the bugs, explain why they are happening, and fix the code.
-
Install the requirement:
pip install -r requirements.txt
-
Run the app:
streamlit run app.py
- The "Hype" Bug: Add a quiet song like "Sleepy Lullaby". Notice it gets sorted into Hype. Ask your AI: "Why does this Python condition
if "rock" or "punk" in titlealways evaluate to True?" - The "Ghost" Bug: Add a song. Then add another. Notice the first one disappears? Ask your AI: "How do I persist variables in Streamlit so they don't reset on every button click?"
- The "Crash" Bug: Click the "I'm Feeling Lucky" button while the list is empty. Watch the app crash. Use AI to write a guardrail to prevent this.