Every programmer makes mistakes and most make mistakes every day.
Although good programmers might create errors and they also know how to respond to these errors efficiently.
Now let's look at an error you will likely to make early on and learn how to fix it.
So we will write some code that generates an error on purpose and enter the this code here.
Message.
Message here and we will write.
Hello.
By then.
Parash.
Or Python.
After that, we will print message.
So if an error occurs in your program, the Python interpreter does its best to help you figure out
where the problem is.
So the interpreter provides a traceback when a program cannot run successfully.
Here.
That's it.
It's actually widen it a little bit.
The traceback is a record of where the interpreter ran into trouble when trying to execute your code.
Here's an example of the traceback that Python provides after you have accidentally misspelled a variable's
name.
Here.
Let's actually use this marker.
Yes.
So here, this is our first line, right?
This is our first line that Python gave us.
So here we have error.
And we also have print function names and name message is not defined.
So here.
The output reports that an error occurs in line two.
Here.
Error occurs in line two of the main dot pi.
Python file and the interpreter shows this line.
To help us to stop the error quickly and tells us what kind of error it found.
In this case, it found the name error and reports that the variable being printed message has not been
defined and Python cannot identify the variable name provided.
A name error usually means we either forgot to set a variable's value before using it or we made a spelling
mistake when entering the variables name.
If Python finds a variable name that's similar to one it doesn't recognize, it will ask if that's the
name you meant to use.
In this example we omitted the letter s in the variable name message in the second line and the python
interpreter doesn't spell check your code, but it does ensure that the variable names are spelled consistently.
So, for example, watch what happens when we spell the message incorrectly in the line that defines
the variable.
Let's actually make this.
That's it.
In this case, the program runs successfully the variable name match.
So Python sees no easy programming language are very strict, but they disregard good and bad spelling.
As a result, you don't need to consider English spelling and grammar rules when you are trying to create
a variable names and writing code.
So many programming errors are simple single character typos in one line of program.
If you find yourself spending a lot of time searching for one of these errors, know that you are in
a good company.
So many experienced and talented programmers spent hours hunting down these kinds of tiny errors.
Try to laugh about it and move on, knowing it will happen frequently throughout your programming live.