1
00:00:00,800 --> 00:00:05,480
Comments are extremely useful feature in most programming languages.

2
00:00:05,540 --> 00:00:10,100
Everything you have written in your program so far is Python code.

3
00:00:10,520 --> 00:00:16,610
As your programs become longer and more complicated, you should add nodes.

4
00:00:17,400 --> 00:00:22,810
Within your programs that describe your overall approach to the problems you're solving?

5
00:00:22,830 --> 00:00:29,460
So a comment allows you to write notes in your spoken language within your programs.

6
00:00:29,460 --> 00:00:34,230
So how do how do you write comments?

7
00:00:34,230 --> 00:00:38,940
So in Python, the hash mark here.

8
00:00:38,970 --> 00:00:41,100
The hash mark.

9
00:00:42,370 --> 00:00:44,590
Let's actually let's use a different color.

10
00:00:44,620 --> 00:00:45,160
Yes.

11
00:00:45,520 --> 00:00:47,590
So the hash mark.

12
00:00:51,950 --> 00:00:53,630
Indicates a comment.

13
00:00:53,960 --> 00:01:00,800
Anything following a hash mark in your code is ignored by the python interpreter here.

14
00:01:00,800 --> 00:01:02,240
As you can see, we got an error here.

15
00:01:02,240 --> 00:01:06,410
That's because in reality my value doesn't exist.

16
00:01:06,410 --> 00:01:08,780
If we comment this, it will not compile.

17
00:01:09,020 --> 00:01:09,950
So.

18
00:01:11,000 --> 00:01:13,240
Let's do something here.

19
00:01:13,250 --> 00:01:14,270
So.

20
00:01:15,050 --> 00:01:15,890
Hello.

21
00:01:16,310 --> 00:01:18,620
Oxley students here.

22
00:01:18,710 --> 00:01:19,340
So.

23
00:01:19,340 --> 00:01:20,540
And print.

24
00:01:22,360 --> 00:01:26,740
Hello Python people and let's run it.

25
00:01:26,740 --> 00:01:29,740
And as you can see, we are seeing only our.

26
00:01:30,580 --> 00:01:36,910
Um, print function and Python ignores the first line and executes the third line.

27
00:01:37,620 --> 00:01:41,010
So what kinds of comments should we should you write?

28
00:01:41,040 --> 00:01:47,400
So the main reason to write comments is to explain what your code is supposed to do and how you are

29
00:01:47,400 --> 00:01:48,420
making it work.

30
00:01:48,450 --> 00:01:54,780
So when you are in the middle of working on a project, you understand how all of the pieces fit together.

31
00:01:54,780 --> 00:02:01,920
But when you return to a project after some time away, you will likely have forgotten some of the details,

32
00:02:01,930 --> 00:02:02,360
right?

33
00:02:02,370 --> 00:02:08,370
So you can always tidy your code for a while and figure out how segments you were supposed to work.

34
00:02:08,370 --> 00:02:15,090
But writing good comments can save you time by summarizing your overall approach clearly.

35
00:02:15,120 --> 00:02:20,940
If you want to become a professional programmer or elaborate with other programmers, you should write

36
00:02:20,940 --> 00:02:22,440
meaningful comments.

37
00:02:22,470 --> 00:02:29,520
Today, most software is written collaboratively, whether by a group of employees at one company or

38
00:02:29,520 --> 00:02:34,200
a group of people working together on an open source project.

39
00:02:34,960 --> 00:02:38,650
Skilled programmers expect to see comments in code.

40
00:02:38,650 --> 00:02:44,410
So it's best to start adding these descriptive comments to your programs now.

41
00:02:44,440 --> 00:02:51,430
Writing clear, concise comments in your code is one of the most beneficial habits you can form as a

42
00:02:51,430 --> 00:02:52,660
new programmer.

43
00:02:52,690 --> 00:03:00,430
So when you're deciding whether to write a comment, ask yourself if you had to consider several approaches

44
00:03:00,430 --> 00:03:04,240
before coming up with a reasonable way to make something go.

45
00:03:04,240 --> 00:03:07,150
So if so, write a comment about your solution.

46
00:03:07,150 --> 00:03:15,700
It's much easier to delete extra comments rather ladder than go back and write comments for sparsely

47
00:03:15,700 --> 00:03:16,990
commented program.

48
00:03:16,990 --> 00:03:27,070
So for now I will use comments in examples throughout this course to help explain what sections of code.
