Section 4.10 Embracing the Journey
As we wrap up this section that deals with handling errors and verifying our solutions work it is important to know that learning to code can be hard at times and sometimes frustrating. However, the feeling you get when your code works is incredible! And your brain grows as you problem solve and debug your programs. Embrace those moments. Pause and think of why things actually went from problematic to working and doing what you want it to do.
Watch this short video about Growing your Mind:
To practice using a growth mindset, if you find yourself saying or thinking whatβs in the left column, try substituting whatβs in the right column instead: Table 4.10.1. A simple table
| Instead of: | Try Thinking/Saying: |
|---|---|
| Iβm not good at this. | I can learn to do this. |
| Iβm awesome at this. | Iβm on the right track. |
| I give up | Iβll use a different learning strategy |
| This is too hard. | This may take some time and effort. |
| I canβt make this any better. | I can improve it! |
| I just canβt do programming. | Iβm going to train my brain to do this. |
| Plan A didnβt work. | Letβs try something else. |
| Itβs good enough. | How can I improve this? |
Subsection 4.10.1 Debugging Tips
Here are some practical tips to help you effectively debug your code, avoid and overcome errors:
-
Make sure you take the time to understand error messages. They can help you a lot.
-
printstatements are your friends. Use them to help you uncover what is really happening in your code. -
Work backward from the error. Many times an error message is caused by something that has happened before it in the program. Always remember that python evaluates a program top to bottom.
-
Simplify complex problems by breaking them into smaller, more manageable parts.
-
Donβt hesitate to ask for help from peers, online communities, or mentors. A fresh perspective can often spot issues you might overlook.
-
Take breaks if you feel frustrated. A clear mind can make problem-solving much easier.
-
Each error is an opportunity to learn. Take note of what caused the error and how you resolved it for future reference.
You have attempted of activities on this page.
