1 00:00:00,000 --> 00:00:02,266 Hey, hi again and welcome to yet another 2 00:00:02,279 --> 00:00:04,019 lecture. In this lecture, I'll show you 3 00:00:04,019 --> 00:00:06,989 how to ask a good programming question. 4 00:00:07,526 --> 00:00:09,064 So I mentioned in the previous lecture 5 00:00:09,089 --> 00:00:10,769 asking a good programming question is 6 00:00:10,769 --> 00:00:14,879 very important to get a good answer, and 7 00:00:14,909 --> 00:00:16,979 let me first show you what's the best 8 00:00:16,979 --> 00:00:19,685 programming question. For instance, 9 00:00:19,710 --> 00:00:21,974 [No audio] 10 00:00:21,999 --> 00:00:26,549 I'm going to click on Ask question, and here 11 00:00:26,549 --> 00:00:28,649 is the title of the question, that 12 00:00:28,679 --> 00:00:30,959 programming question would have a very 13 00:00:30,959 --> 00:00:33,179 generic title like that. Here is the 14 00:00:33,179 --> 00:00:34,979 body of the question where you 15 00:00:34,979 --> 00:00:36,569 have to describe your question in 16 00:00:36,569 --> 00:00:39,719 detail. Some people, they just say I got 17 00:00:40,012 --> 00:00:45,892 an error when trying to two numbers, 18 00:00:45,917 --> 00:00:47,968 [No audio] 19 00:00:47,999 --> 00:00:49,155 and they just post the question. 20 00:00:49,179 --> 00:00:51,565 [No audio] 21 00:00:51,590 --> 00:00:54,929 A better question would be to include the error 22 00:00:54,929 --> 00:00:58,388 the code there that you executed, like that. 23 00:00:58,412 --> 00:01:01,795 [No audio] 24 00:01:01,820 --> 00:01:03,779 However, that is also not enough, 25 00:01:03,809 --> 00:01:05,759 because you also need to show the error 26 00:01:05,759 --> 00:01:08,579 message. So let me delete this, and a 27 00:01:08,579 --> 00:01:12,119 good programming question would be, when 28 00:01:12,119 --> 00:01:13,889 we're talking about questions that have 29 00:01:13,919 --> 00:01:17,879 an error, questions that talk about an 30 00:01:17,879 --> 00:01:20,519 error that you got in your code. So this 31 00:01:20,519 --> 00:01:23,129 is your code, a good title would be to 32 00:01:23,159 --> 00:01:27,479 include the error message, so that it 33 00:01:27,479 --> 00:01:29,399 would be a good fit. If it's a very long 34 00:01:29,424 --> 00:01:31,074 message, then you can 35 00:01:31,444 --> 00:01:33,514 choose to include all with the name of 36 00:01:33,539 --> 00:01:37,319 the error with all that, and then a good 37 00:01:37,344 --> 00:01:41,634 question would be Hi, I run the following 38 00:01:41,735 --> 00:01:47,195 code and expect text to get division 39 00:01:47,610 --> 00:01:53,981 in the last print main parts, but I got an error. 40 00:01:54,005 --> 00:01:56,479 [No audio] 41 00:01:56,504 --> 00:01:57,588 Here is my code. 42 00:01:57,612 --> 00:02:00,081 [No audio] 43 00:02:00,106 --> 00:02:03,809 So you've put the code there of your entire script. 44 00:02:04,469 --> 00:02:07,529 Don't worry, if your question is long, 45 00:02:07,829 --> 00:02:09,599 it's better to be long than to be 46 00:02:09,599 --> 00:02:12,721 incomplete, and 47 00:02:13,566 --> 00:02:18,214 here is the error. Here, 48 00:02:18,239 --> 00:02:21,569 make sure to include your entire 49 00:02:21,599 --> 00:02:24,972 error TraceBack, including the output 50 00:02:24,997 --> 00:02:29,549 as well. So from this line of the command 51 00:02:29,549 --> 00:02:32,369 line, up to the next line, so this 52 00:02:32,399 --> 00:02:34,949 entire thing goes to your question, just 53 00:02:34,949 --> 00:02:37,078 copy it. Don't worry if it's long. 54 00:02:37,102 --> 00:02:39,139 [No audio] 55 00:02:39,164 --> 00:02:40,164 Can you help? 56 00:02:40,188 --> 00:02:42,499 [No audio] 57 00:02:42,524 --> 00:02:43,769 So that'd be a good 58 00:02:43,769 --> 00:02:46,169 programming question. Now, this is still 59 00:02:46,169 --> 00:02:48,329 missing something very important, and 60 00:02:48,354 --> 00:02:50,334 that is highlighting of the code. 61 00:02:50,849 --> 00:02:53,129 You need to select the code and click on 62 00:02:53,129 --> 00:02:54,689 this icon here. 63 00:02:54,713 --> 00:02:57,695 [No audio] 64 00:02:57,720 --> 00:02:58,755 The error as well, 65 00:02:58,780 --> 00:03:02,691 [No audio] 66 00:03:02,726 --> 00:03:04,392 and let me post the question. 67 00:03:04,417 --> 00:03:06,767 [No audio] 68 00:03:06,792 --> 00:03:09,055 External links must provide free educational 69 00:03:09,079 --> 00:03:11,040 content, just click on Proceed. 70 00:03:11,064 --> 00:03:13,805 [No audio] 71 00:03:13,830 --> 00:03:15,960 And here is a question here, and here is how 72 00:03:15,990 --> 00:03:17,850 it looks like on the other end. So this 73 00:03:17,850 --> 00:03:20,640 question has four good elements that 74 00:03:20,640 --> 00:03:22,470 make it a good question. The first 75 00:03:22,470 --> 00:03:27,210 element is that the poster is mentioning 76 00:03:27,210 --> 00:03:30,750 what he or she expected to get as output 77 00:03:30,990 --> 00:03:33,360 from the script that they were running. 78 00:03:34,980 --> 00:03:37,080 So it says I was explaining to get the 79 00:03:37,080 --> 00:03:39,060 division in the last print statement 80 00:03:39,060 --> 00:03:40,950 which is this one here, but I got an 81 00:03:40,950 --> 00:03:44,040 error. So the first thing is, you need 82 00:03:44,040 --> 00:03:45,870 to include the expected output, you need 83 00:03:45,870 --> 00:03:47,730 to explain what you were expecting. 84 00:03:47,940 --> 00:03:50,880 Because otherwise, if you don't explain 85 00:03:50,880 --> 00:03:52,770 what you are expected that the other 86 00:03:52,800 --> 00:03:56,130 person who wants to help you doesn't 87 00:03:56,130 --> 00:04:00,900 know the goal of your code, or of your 88 00:04:00,900 --> 00:04:02,760 questions, so it doesn't know how to help 89 00:04:02,760 --> 00:04:05,010 you to reach to that goal. So expect 90 00:04:05,010 --> 00:04:06,720 output is the first thing. The second 91 00:04:06,720 --> 00:04:08,921 thing is you need to include your entire code, 92 00:04:10,664 --> 00:04:12,690 and make sure that you include 93 00:04:12,690 --> 00:04:15,450 your code as texts is best to use text as 94 00:04:15,450 --> 00:04:17,970 rather than screenshots 95 00:04:18,000 --> 00:04:20,880 because text, the person who wants to 96 00:04:20,880 --> 00:04:23,970 help you can copy your code and 97 00:04:23,995 --> 00:04:26,185 run it on their Python interpreter. 98 00:04:27,545 --> 00:04:29,405 But if you include 99 00:04:29,430 --> 00:04:31,650 screenshots, they are images and it's 100 00:04:31,650 --> 00:04:35,349 hard for other people to try out your code. 101 00:04:35,373 --> 00:04:37,618 [No audio] 102 00:04:37,643 --> 00:04:39,810 If you ask this on Stack Overflow, 103 00:04:39,810 --> 00:04:42,120 your question would get closed because 104 00:04:42,330 --> 00:04:44,670 if you ask it using a screenshot, 105 00:04:44,790 --> 00:04:47,220 rather than the text version of your 106 00:04:47,220 --> 00:04:49,740 code, the question will get closed 107 00:04:49,740 --> 00:04:52,290 because there are very strong rules in 108 00:04:52,350 --> 00:04:55,950 Stack Overflow to have a high quality 109 00:04:56,195 --> 00:04:57,756 question and answer site. 110 00:04:59,263 --> 00:05:01,650 So that's it second element. The third element is you 111 00:05:01,650 --> 00:05:04,560 need to include your entire screenshot, 112 00:05:04,830 --> 00:05:09,545 entire error TraceBack, sorry. So from 113 00:05:09,570 --> 00:05:12,420 the beginning up to the end, whether its 114 00:05:12,420 --> 00:05:14,700 the third element, and the last element, the 115 00:05:14,700 --> 00:05:16,560 fourth element is you need to highlight 116 00:05:16,560 --> 00:05:19,860 your code. Just like that. You see this 117 00:05:19,860 --> 00:05:21,900 is much more visible and easier for 118 00:05:21,900 --> 00:05:23,255 others to troubleshoot. 119 00:05:23,279 --> 00:05:26,106 [No audio] 120 00:05:26,139 --> 00:05:29,940 So the course interface has that function there that 121 00:05:29,940 --> 00:05:31,800 you can highlight your code on Stack 122 00:05:31,800 --> 00:05:33,780 Overflow, or you also have that 123 00:05:33,780 --> 00:05:36,030 capability. So just go to Ask Question. 124 00:05:36,030 --> 00:05:37,155 You write the code here, 125 00:05:37,309 --> 00:05:39,888 and highlight it using this 126 00:05:41,095 --> 00:05:42,221 curly brackets. 127 00:05:42,245 --> 00:05:44,245 [No audio] 128 00:05:44,267 --> 00:05:47,580 Yeah, that's it. If you ask good questions, 129 00:05:47,610 --> 00:05:49,410 the odds are that you're going to get a 130 00:05:49,410 --> 00:05:51,630 good answer as well. So I hope this 131 00:05:51,630 --> 00:05:54,480 makes sense, and I hope I showed you 132 00:05:54,480 --> 00:05:56,580 something that you didn't know, and I'll 133 00:05:56,580 --> 00:05:59,746 talk to you later see you.