1
00:00:00,540 --> 00:00:02,970
Hello and welcome to this video.

2
00:00:03,870 --> 00:00:16,000
Indentation and Pi tone is used to separate or section off parts of a block of code by Tom.

3
00:00:16,140 --> 00:00:25,090
Unlike other languages does not use semicolons or curly braces to indent code pi.

4
00:00:25,110 --> 00:00:38,750
Tom uses white spaces to separate code blocks so as to indent the parts of the code so indentation in

5
00:00:38,860 --> 00:00:49,170
Python is very important indentation in Python can be created using tabs or spaces.

6
00:00:49,170 --> 00:00:57,240
However it is recommended that you use spaces and not tab to intent.

7
00:00:57,240 --> 00:01:04,800
And when you do use spaces for indentation make sure that they are four spaces you could be more but

8
00:01:04,800 --> 00:01:15,280
it is recommended to indent using four spaces so also advisable not to mix the indentation.

9
00:01:15,300 --> 00:01:22,390
So don't indent with spaces and also indent with tabs that will confuse python.

10
00:01:22,500 --> 00:01:31,870
So I would recommend you stick to using spaces to indent your code inside my text editor.

11
00:01:32,390 --> 00:01:37,650
I'm what a python file which is this file here on my desktop.

12
00:01:37,710 --> 00:01:44,640
This is the content of the file so you can see here the print statements are all on the same line which

13
00:01:44,640 --> 00:01:50,640
is OK so if I run this block of code inside my terminal on the bottom here.

14
00:01:50,730 --> 00:01:58,190
So I just need to do call the application by his name so I do my up dot P Way.

15
00:01:58,200 --> 00:02:06,990
If you are on a Mac you need to type in Python 3 followed by the name of the python file before you

16
00:02:06,990 --> 00:02:08,160
can run it.

17
00:02:08,190 --> 00:02:16,640
Now you can see here the content of the file has been output it in my console here.

18
00:02:16,740 --> 00:02:25,060
Now these lines of code as it is is proper properly indented so indentation.

19
00:02:25,200 --> 00:02:33,910
If I wanted to for example if I should then that just do that.

20
00:02:33,910 --> 00:02:39,110
This and I tried to run this file again.

21
00:02:39,130 --> 00:02:45,640
It will fail because the indentation is out of line is not appropriate.

22
00:02:45,640 --> 00:02:51,200
So let me go to my terminal and run again.

23
00:02:51,220 --> 00:02:52,870
I expect to get an error.

24
00:02:52,870 --> 00:02:59,190
You can see here tells me gives me that they print told me where the error is which is this online too.

25
00:02:59,200 --> 00:03:05,260
You can see that says silence is true friend which is this one says telling me that the indentation

26
00:03:05,920 --> 00:03:07,540
is not correct.

27
00:03:08,170 --> 00:03:13,390
So once the indentation is wrong it does not run the code.

28
00:03:13,390 --> 00:03:19,920
This is very important when you are writing several lines of code to make sure that it is properly indented

29
00:03:20,380 --> 00:03:24,090
okay because these are all single line statements.

30
00:03:24,370 --> 00:03:27,200
They have to be on the same line.

31
00:03:27,550 --> 00:03:31,630
So that's why the indentation is important.

32
00:03:31,630 --> 00:03:39,970
If you had several block of code in different sections you used indentation to separate the sections

33
00:03:39,970 --> 00:03:46,600
of the code so that each block belongs to a certain section with single line.

34
00:03:46,600 --> 00:03:51,910
Comments like these is OK because it's just print statement and they all should be on the same lines

35
00:03:51,970 --> 00:03:54,440
because they are not part of a block.

36
00:03:54,460 --> 00:03:58,150
They are independent so they have to be on the same line.

37
00:03:58,210 --> 00:04:05,980
If you try to shift them like I did on this one it you know it impacts because it means indentation

38
00:04:06,070 --> 00:04:10,870
is not correct and therefore gives you an error in the application.

39
00:04:10,870 --> 00:04:16,270
So that's basically how indentation works so is very important in Python.

40
00:04:16,270 --> 00:04:18,160
Thanks for watching and bye for now.
