1 00:00:00,630 --> 00:00:05,880 Every programmer makes mistakes and most make mistakes every day. 2 00:00:06,300 --> 00:00:13,920 Although good programmers might create errors and they also know how to respond to these errors efficiently. 3 00:00:14,100 --> 00:00:20,640 Now let's look at an error you will likely to make early on and learn how to fix it. 4 00:00:20,670 --> 00:00:28,800 So we will write some code that generates an error on purpose and enter the this code here. 5 00:00:29,340 --> 00:00:30,090 Message. 6 00:00:31,630 --> 00:00:35,080 Message here and we will write. 7 00:00:35,410 --> 00:00:35,950 Hello. 8 00:00:38,180 --> 00:00:38,990 By then. 9 00:00:39,470 --> 00:00:40,190 Parash. 10 00:00:41,380 --> 00:00:42,190 Or Python. 11 00:00:45,940 --> 00:00:49,180 After that, we will print message. 12 00:00:52,390 --> 00:00:58,870 So if an error occurs in your program, the Python interpreter does its best to help you figure out 13 00:00:58,870 --> 00:01:00,550 where the problem is. 14 00:01:02,840 --> 00:01:09,140 So the interpreter provides a traceback when a program cannot run successfully. 15 00:01:09,410 --> 00:01:09,980 Here. 16 00:01:10,220 --> 00:01:11,060 That's it. 17 00:01:12,040 --> 00:01:14,140 It's actually widen it a little bit. 18 00:01:17,500 --> 00:01:25,570 The traceback is a record of where the interpreter ran into trouble when trying to execute your code. 19 00:01:26,390 --> 00:01:33,320 Here's an example of the traceback that Python provides after you have accidentally misspelled a variable's 20 00:01:33,320 --> 00:01:33,890 name. 21 00:01:34,850 --> 00:01:35,510 Here. 22 00:01:35,690 --> 00:01:37,820 Let's actually use this marker. 23 00:01:37,820 --> 00:01:38,390 Yes. 24 00:01:39,040 --> 00:01:41,470 So here, this is our first line, right? 25 00:01:41,740 --> 00:01:44,770 This is our first line that Python gave us. 26 00:01:45,190 --> 00:01:48,460 So here we have error. 27 00:01:49,830 --> 00:01:55,830 And we also have print function names and name message is not defined. 28 00:01:56,670 --> 00:01:58,110 So here. 29 00:01:59,380 --> 00:02:04,900 The output reports that an error occurs in line two. 30 00:02:05,890 --> 00:02:06,370 Here. 31 00:02:06,490 --> 00:02:12,010 Error occurs in line two of the main dot pi. 32 00:02:13,780 --> 00:02:17,620 Python file and the interpreter shows this line. 33 00:02:20,800 --> 00:02:26,470 To help us to stop the error quickly and tells us what kind of error it found. 34 00:02:26,860 --> 00:02:34,810 In this case, it found the name error and reports that the variable being printed message has not been 35 00:02:34,810 --> 00:02:39,970 defined and Python cannot identify the variable name provided. 36 00:02:40,330 --> 00:02:46,960 A name error usually means we either forgot to set a variable's value before using it or we made a spelling 37 00:02:46,960 --> 00:02:50,050 mistake when entering the variables name. 38 00:02:50,440 --> 00:02:59,380 If Python finds a variable name that's similar to one it doesn't recognize, it will ask if that's the 39 00:02:59,380 --> 00:03:01,210 name you meant to use. 40 00:03:01,360 --> 00:03:08,440 In this example we omitted the letter s in the variable name message in the second line and the python 41 00:03:08,440 --> 00:03:14,500 interpreter doesn't spell check your code, but it does ensure that the variable names are spelled consistently. 42 00:03:15,400 --> 00:03:21,490 So, for example, watch what happens when we spell the message incorrectly in the line that defines 43 00:03:21,490 --> 00:03:22,530 the variable. 44 00:03:22,540 --> 00:03:23,830 Let's actually make this. 45 00:03:25,150 --> 00:03:25,960 That's it. 46 00:03:25,960 --> 00:03:30,850 In this case, the program runs successfully the variable name match. 47 00:03:30,850 --> 00:03:38,380 So Python sees no easy programming language are very strict, but they disregard good and bad spelling. 48 00:03:38,380 --> 00:03:44,020 As a result, you don't need to consider English spelling and grammar rules when you are trying to create 49 00:03:44,020 --> 00:03:45,820 a variable names and writing code. 50 00:03:45,880 --> 00:03:52,840 So many programming errors are simple single character typos in one line of program. 51 00:03:52,840 --> 00:03:59,860 If you find yourself spending a lot of time searching for one of these errors, know that you are in 52 00:03:59,860 --> 00:04:00,700 a good company. 53 00:04:01,380 --> 00:04:09,600 So many experienced and talented programmers spent hours hunting down these kinds of tiny errors. 54 00:04:09,630 --> 00:04:17,130 Try to laugh about it and move on, knowing it will happen frequently throughout your programming live.