Debugging - Jupyter Notebook
Debugging - Jupyter Notebook
It is very common to make mistakes while programming in any language. Fortunately, python is able to
recognize lots of types of mistakes and tell us what the problem is. The process of identifying and fixing
errors, or bugs, in your code is called debugging. It is very important to learn to debug your code, no matter
how much experience you have programming you will inevitably make a mistake, you must learn to
efficiently identify and fix your mistakes.
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[1], line 1
----> 1 my_dict = {var1: 2, "var2": 16}
2
3
4
5
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
Cell In[3], line 3
1 array = [1,2,3,4,5]
2 for j in array:
----> 3 print(array[j])
myobj = MyClass(5,6)
print('attr1 is equal to', myobj.attr1)
myobj.attr2
attr2 is equal to 6
attr1 is equal to 5
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[5], line 10
7 myobj = MyClass(5,6)
9 print('attr1 is equal to', myobj.attr1)
---> 10 myobj.attr2
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[4], line 3
1 import numpy as np
2 nparray = np.array([1,2,3,4,5,6])
----> 3 mean(nparray)
In [ ]: