Learning can be hard, but we don't want you to feel hopeless and lost. Every programmer had a moment where they didn't know what was wrong with their code.
So here are some suggestions to help you troubleshoot your code and figure out what's going wrong:
1. Carefully read the instructions one more time. Make sure that you understand the task completely.
2. Check your code for spelling mistakes and punctuation. Maybe you just lost a comma or forgot to close the braces.
3. Make sure that your code is clean and indented correctly. Especially if you're coding in Python. Moreover, it's way easier to debug an organized code.
4. Check out the comment section. Someone may have left a hint to help other users solve this problem.
5. Take a break! Change of scenery can help you look at the problem with fresh eyes.
6. Check out our topic on debugging. It will help you understand how to write code in an organized and clear way.
7. If nothing else works and you still have no idea what is wrong with your code, use one of the helping options:
- Download a test. Seeing the input that doesn't work might help you understand what's not working out.
- Check out other learners' solutions. It doesn't mean that you gave up and didn't learn anything! Just make sure to read the solution line by line and understand every word of it.
Most importantly, don't get discouraged! Every mistake that you make, every difficulty that you overcome — it's all learning process.