WEBVTT 0 00:00.590 --> 00:04.300 In this lecture let's talk about how to execute a Python program. 1 00:04.350 --> 00:07.790 So in the previous video I talked about.. Like if we search about Python 2 00:07.790 --> 00:09.990 We get several type of options, 3 00:10.010 --> 00:16.770 One is the desktop app, we have then IDLE then we have some module documents and so what all these are? 4 00:16.940 --> 00:22.470 So let me clarify that there are a few different options by which you can run your 'python commands' 5 00:22.550 --> 00:25.110 The first one is python command line windows. 6 00:25.220 --> 00:28.470 That is the exact option that we tried in the earlier lecture. 7 00:28.580 --> 00:29.920 So just click here, 8 00:29.930 --> 00:35.920 So this is the Windows that is by default given by Python and you can run all the codes here 9 00:35.990 --> 00:41.510 That is some basic codes, because once you start working on big files, once you start working with different 10 00:41.510 --> 00:49.610 libraries we'll be moving towards the file system, we will be moving towards the editor that is IDE system and 11 00:49.610 --> 00:51.520 that will help us to simplify 12 00:51.540 --> 00:53.210 our file system. 13 00:53.210 --> 00:55.570 So this is the python command line windows 14 00:55.670 --> 01:02.300 You can perform some basic tasks like let me write my first code here. If I want to write print hello world 15 01:02.560 --> 01:09.240 all I have to do is just give me "print" statement and you can see its just printed 16 01:09.380 --> 01:15.530 And if I just want to do some basic calculation maybe three plus five and you can understand that this 17 01:15.530 --> 01:21.460 is the basic command line prompt which is use to do some basic Python stuff. 18 01:21.620 --> 01:27.860 At this point of time this is the basic medium by which you can do some basic Python coding. 19 01:27.860 --> 01:29.910 The second thing is Python IDLE 20 01:29.950 --> 01:36.980 that is they have provided us a graphic window which is quite easy and it define with different 21 01:36.980 --> 01:37.600 colors 22 01:37.640 --> 01:40.610 and I hate it because the background is white 23 01:40.820 --> 01:45.880 and as a programmer as a developer something that is white you will hate it. 24 01:46.310 --> 01:52.610 I'm sure once you start working with Python with any language and you start working with editor that 25 01:52.610 --> 02:01.190 is IDE you'll start loving the Black color. Let me search Python here and you can see this IDLE option 26 02:01.460 --> 02:04.640 Just click on the option and you'll see something like this. 27 02:04.670 --> 02:11.810 This is our Python shell which is quite similar to what we were doing with the previous command window and 28 02:11.810 --> 02:16.620 here you can also perform the same step if you want to do print("Hello World") 29 02:16.760 --> 02:21.320 Let me type it out and now you can see the color difference. 30 02:21.320 --> 02:27.530 This is the important thing that you need to keep in mind all the IDE's make our lives easier, they define 31 02:27.560 --> 02:28.990 everything with different colors. 32 02:29.000 --> 02:31.830 and also they help us to complete some things. 33 02:31.970 --> 02:38.750 So if I write print again and you can see they have given me several options regarding my value, regarding 34 02:38.750 --> 02:42.430 the separation and all the things we'll be talking about in new lectures 35 02:42.650 --> 02:48.230 but at this point of time you have to understand why an IDE like this is important. 36 02:48.440 --> 02:55.370 So if I just want to write "Hello World" again or something like "Hello" only or "Hello Students" now you can 37 02:55.370 --> 03:01.220 see it clearly defines different thing and this will help us to perform tasks in a better manner. 38 03:01.460 --> 03:04.650 The next option is directly from system prompt 39 03:04.820 --> 03:10.700 So if you are working on Windows you might have command prompt and if you are on Mac you might have 40 03:10.940 --> 03:11.810 the terminal. 41 03:12.020 --> 03:17.640 So all you have to do is just do CMD and just open this particular command prompt. 42 03:17.840 --> 03:24.250 And here you can write python and this will now enter into your shell mode that is python shell mode 43 03:24.590 --> 03:26.760 and you will also see the Python version. 44 03:26.870 --> 03:32.240 And if you want to exit it at any point of time all you have to type is exit and then open and closing 45 03:32.240 --> 03:33.320 parentheses 46 03:33.680 --> 03:39.410 and similarly if you want to exit from your Python shell you have to perform the same and that will do 47 03:39.410 --> 03:40.260 your task. 48 03:40.290 --> 03:44.320 and if you want to save this task or kill this task that is your choice. 49 03:44.540 --> 03:49.650 You can also try quit() and that will also do the same step. 50 03:51.250 --> 03:53.750 So these are some basic method that you can do is, 51 03:53.910 --> 03:56.740 The first one is your Python command line window. 52 03:56.950 --> 04:03.000 The second one is the python IDLE which is the graphics window and the third one is your CMD 53 04:03.010 --> 04:09.800 Now if you have a python file that ends with .py At that point of time only your command prompt 54 04:09.800 --> 04:10.720 will be useful. 55 04:10.720 --> 04:12.240 Let me give you an example. 56 04:12.430 --> 04:16.350 Let me open my notepad and yeah no developer code in Notepad. 57 04:16.360 --> 04:18.690 I'm just doing that so you can understand. 58 04:19.000 --> 04:25.210 and if you have any code and you have .py file and if you want to run any project, any application 59 04:25.600 --> 04:28.430 at that point of time your CMD will be useful. 60 04:28.510 --> 04:31.840 Let me create a basic py file and then we can perform. 61 04:31.840 --> 04:34.830 So in this .py file let me write. 62 04:35.170 --> 04:39.790 So this is the basic code that I have written and now I have to save it as .py 63 04:40.000 --> 04:43.060 So all I have to do is let me save it somewhere. 64 04:46.890 --> 04:53.490 So now I have just created .py file that is my first.py in which I have something to print and 65 04:53.490 --> 04:58.070 if I want to run this particular file I can only do that with my system prompt 66 04:58.080 --> 04:59.430 That is my CMD 67 04:59.760 --> 05:02.690 And if you are a Mac user you can use your terminal. 68 05:02.730 --> 05:07.400 So open your terminal that is your command prompt on your desktop. 69 05:07.440 --> 05:13.560 You can use your control + shift and then the right key and then click on 'Open command windows here' and 70 05:13.560 --> 05:16.750 you can see I have my windows in my desktop folder 71 05:16.770 --> 05:23.950 Now all I have to do is write Python then the filename that is first.py and click enter. 72 05:24.300 --> 05:26.550 So here you can see I have the text. 73 05:26.550 --> 05:31.520 This is a .py file which I have mentioned in my first.py 74 05:31.740 --> 05:35.260 So this is how you run your .py that is your python file 75 05:35.550 --> 05:39.990 So now I hope you understand how to run your first project or how to write your first 76 05:39.990 --> 05:40.850 command 77 05:41.130 --> 05:46.830 and there is one last and important method that no one usually mention that is your online shell. 78 05:47.010 --> 05:52.530 These shells are really important if you want to solve any problem, if you are into competition online. 79 05:52.770 --> 05:57.350 So these shell work exactly the same like you are working on your desktop 80 05:57.630 --> 06:04.140 So the only difference is you cannot create files, you cannot download application libraries here but 81 06:04.140 --> 06:08.570 you can perform similar steps if you want to print something here. 82 06:08.880 --> 06:16.020 So let me print "This is online shell" and then run this command and you can see that's working exactly 83 06:16.020 --> 06:18.400 fine like on my desktop 84 06:18.540 --> 06:25.020 So I hope you understand how to execute your python file, your .py file and how to use your IDLE 85 06:25.080 --> 06:28.390 your command prompt to run your Python code. 86 06:28.470 --> 06:31.630 and I hope now you have understand how to print Hello world. 87 06:31.830 --> 06:39.360 So all you have to do is write print, open parentheses, your quote symbol then the text that you want to print 88 06:39.520 --> 06:43.140 again your quote symbol and then the closing parentheses. 89 06:43.430 --> 06:46.120 Now you can print something in your python shell. 90 06:46.220 --> 06:52.140 So that's the task that you have to perform now and I hope you will understand this. In the next lecture 91 06:52.140 --> 06:53.890 Let's talk more about Python.