1 00:00:00,180 --> 00:00:05,450 Python programming tutorial for beginners - Hello welcome to this tutorial on introduction to fight them. 2 00:00:05,580 --> 00:00:14,440 And in this section we will talk about the Python programming language integrated development environment. 3 00:00:14,440 --> 00:00:20,860 I D E Python 2 version vs. Python 3. 4 00:00:21,080 --> 00:00:30,920 Installing python using the anaconda distribution so Python is a very simple language which is easier 5 00:00:31,010 --> 00:00:41,540 to learn and it has an elegant syntax so it allows us to think about the problem or solution rather 6 00:00:41,540 --> 00:00:52,830 than focusing on the syntax mixed Python is a high level interpreted language programming languages 7 00:00:53,100 --> 00:01:04,410 generally fall in to one of the two categories interpreted and compiler language use. 8 00:01:04,460 --> 00:01:10,940 So what is the difference between compiled languages and interpreted languages. 9 00:01:10,940 --> 00:01:22,970 A compiler converts a high level language code such as Java C or Python to machine code. 10 00:01:23,230 --> 00:01:26,570 So here we have a compiler 11 00:01:30,550 --> 00:01:37,170 that can words the source code or the higher labour language code. 12 00:01:37,580 --> 00:01:44,290 Core code that is in high level language in two machine code 13 00:01:54,820 --> 00:02:00,460 and the compiler translate the code all at once. 14 00:02:00,460 --> 00:02:11,590 So all these statements in a program are translated at once and the process word then executes upon 15 00:02:11,590 --> 00:02:14,650 the machine language that the compiler has produced. 16 00:02:15,220 --> 00:02:25,980 So here we have the process word that executes the machine code 17 00:02:28,820 --> 00:02:36,960 now for example if you have to make any changes to the code that has already been compiled. 18 00:02:37,100 --> 00:02:49,280 Say for example you have added a new statement in the existing code. 19 00:02:49,470 --> 00:02:54,630 In that case the entire program will need to be combined 20 00:02:59,590 --> 00:03:09,220 so the process of compile nation is slow but machine code can be executed quickly. 21 00:03:12,200 --> 00:03:20,710 And examples of compiled languages are C and B have Cobol 22 00:03:23,210 --> 00:03:25,750 and Basic 23 00:03:29,940 --> 00:03:31,920 coming to interpreted languages 24 00:03:34,740 --> 00:03:47,130 and interpreter translates code into machine good so it translates code into machine code 25 00:03:50,580 --> 00:04:00,450 but in this case we have an interpreter that does this job. 26 00:04:00,550 --> 00:04:06,280 So what is the difference between a compiler and an interpreter. 27 00:04:06,280 --> 00:04:11,660 The interpreter translates code instruction by instruction. 28 00:04:11,860 --> 00:04:24,060 So in your source code it goes to the first statement and then it translates into machine code. 29 00:04:24,160 --> 00:04:35,520 The next step and in the next step the CB you execute each instruction DCP you execute this instruction. 30 00:04:35,680 --> 00:04:47,140 So statement 1 has been translated into machine code by the interpreter and this is act executed by 31 00:04:47,140 --> 00:04:49,040 the. 32 00:04:51,610 --> 00:04:52,480 Next. 33 00:04:52,620 --> 00:05:04,080 The interpreter translate this section statement in your program to machine code and DCP you execute 34 00:05:04,140 --> 00:05:05,670 that particular instruction 35 00:05:09,110 --> 00:05:19,190 so interpreter code will show an error as soon as it hits a problem so it is easier to debug then compile 36 00:05:19,190 --> 00:05:25,070 code in case of compile languages. 37 00:05:25,070 --> 00:05:31,100 The bugs are reported after the entire program has been compiled 38 00:05:33,850 --> 00:05:42,040 so since then an interpreter translates code into machine code instruction by an instruction. 39 00:05:42,150 --> 00:05:48,310 They are much slower to execute than the same program that has been completely combined. 40 00:05:48,640 --> 00:05:57,630 However interpreted interpreter languages have usefulness in areas where speed doesn't matter say for 41 00:05:57,630 --> 00:06:09,470 example you can use it for debugging R for training purposes and examples of interpreter languages include 42 00:06:09,920 --> 00:06:12,630 Python Ruby. 43 00:06:13,280 --> 00:06:20,700 But so these are some of the examples for compiled and interpreted languages. 44 00:06:20,720 --> 00:06:30,050 Now let's get back to the area of left python and Python is an object oriented language and it is a 45 00:06:30,050 --> 00:06:33,260 free and open source software. 46 00:06:33,920 --> 00:06:39,290 You can freely use and distribute Python even for commercial use. 47 00:06:39,290 --> 00:06:45,890 Not only can you use and distribute software that ended it you can even make changes to the python's 48 00:06:46,010 --> 00:06:48,400 source code next. 49 00:06:48,530 --> 00:06:51,210 Python is portable. 50 00:06:51,410 --> 00:06:58,760 We can move python programs from one platform to another and add on it without any changes. 51 00:06:58,760 --> 00:07:05,910 It runs seamlessly on almost all platforms including windows macros and Linux. 52 00:07:06,160 --> 00:07:12,350 Didn't standard libraries very extensive offering a wide range of facilities. 53 00:07:12,590 --> 00:07:20,420 By then provide standardize solution for many problems that occurred in everyday programming and bulk 54 00:07:20,420 --> 00:07:23,740 of the library is very portable. 55 00:07:24,110 --> 00:07:32,750 Next then has a great community that provide support through mailing list user contributed documentation 56 00:07:32,840 --> 00:07:44,060 and already active Stack Overflow group the next topic is Ida E which is integrated development environment 57 00:07:45,600 --> 00:07:54,700 a 90 is according to which allows you to write test and debug your code in an easier way. 58 00:07:56,280 --> 00:08:05,100 Technically you can write your code in a notepad but your windows notepad say for example does not highlight 59 00:08:05,100 --> 00:08:12,990 the syntax say giving a color code to all the functions that you have defined in your program and it 60 00:08:12,990 --> 00:08:21,090 does not provide debugging tools and you cannot execute the program directly from notepad application 61 00:08:22,340 --> 00:08:27,680 so you'd have to save to file and run the code from a command prompt. 62 00:08:27,680 --> 00:08:31,520 And for this you need two different programs. 63 00:08:31,520 --> 00:08:33,530 Next we have the IDA. 64 00:08:33,650 --> 00:08:41,720 E which is the integrated development and learning environment provided with Python. 65 00:08:41,720 --> 00:08:50,150 It ideally allows to create read edit and execute your programs under the same roof without touching 66 00:08:50,150 --> 00:08:57,010 the command line using the ideally is not a requirement for using Python. 67 00:08:57,020 --> 00:09:04,250 There are many other ideas that can be used to write python programs that are also text based program 68 00:09:04,340 --> 00:09:10,160 editors using the ideally is not a requirement for using Python. 69 00:09:10,190 --> 00:09:15,060 There are many other good ideas that can be used to write python programs. 70 00:09:15,110 --> 00:09:20,930 For example there is by chance then spider Komodo. 71 00:09:20,930 --> 00:09:25,580 Edit atom sublime text etc.. 72 00:09:25,760 --> 00:09:34,810 D I D E is a combination of a text editor and the Python interpreter as we have just discussed that 73 00:09:34,820 --> 00:09:39,640 the IDC can be used to write and test your code. 74 00:09:40,060 --> 00:09:40,600 Yeah. 75 00:09:40,670 --> 00:09:50,060 I have given a print function to printer text Hello war and then the IBC can also be used to do mathematical 76 00:09:50,060 --> 00:09:59,540 operations like additions subtractions and so on and in order to execute these statements we need an 77 00:09:59,600 --> 00:10:00,620 interpreter. 78 00:10:00,830 --> 00:10:03,310 In case of the Python programming language. 79 00:10:03,320 --> 00:10:13,140 We use the interpreter nada to translate the human readable code to machine code and the interpreter 80 00:10:13,220 --> 00:10:14,750 works in two modes. 81 00:10:14,750 --> 00:10:18,310 One is the interactive mode and the other. 82 00:10:18,410 --> 00:10:22,470 Script mode in the interactive more. 83 00:10:22,480 --> 00:10:27,290 The interpreter gives immediate feedback for each statement. 84 00:10:27,340 --> 00:10:36,160 It also stores the output of previously executed statements in active memory as we enter a new statement 85 00:10:36,220 --> 00:10:43,660 or as a new statement get executed the entire sequence of previously executed statement is considered 86 00:10:43,990 --> 00:10:47,350 while evaluating the current output. 87 00:10:47,350 --> 00:10:49,230 So what do we mean by this. 88 00:10:49,240 --> 00:10:58,720 Say for example if not i d e v and build the first statement I assign value to to the variable e and 89 00:10:58,720 --> 00:11:00,230 run the interpreter. 90 00:11:00,460 --> 00:11:09,220 The interpreter draws the output of the Executed statement in active memory and then in the second line 91 00:11:09,760 --> 00:11:17,320 I assign the value three to the variable B and then drown the interpreter. 92 00:11:17,320 --> 00:11:31,200 Again next in the third line I give a variable and C which and debatable is a and b and run the interpreter 93 00:11:31,200 --> 00:11:43,610 again now using the print function I would like to display the value all the variable C 94 00:11:46,820 --> 00:11:51,200 ask new statement that executed by the Python interpreter. 95 00:11:51,200 --> 00:12:03,030 The entire sequence or previously executed statement is considered by evaluating the current output 96 00:12:04,900 --> 00:12:14,680 and the interactive mode is a good way to play around and try variations on syntax coming to the script 97 00:12:14,910 --> 00:12:15,850 mode. 98 00:12:15,880 --> 00:12:23,380 This script more we give Python of i of JD ment and the interpreter interpret all of the statements 99 00:12:23,440 --> 00:12:24,580 in that script. 100 00:12:24,580 --> 00:12:30,120 Interactive mode is great for testing small chunks of code but there is one problem. 101 00:12:30,130 --> 00:12:35,850 These statements you enter into Python no i d e are not saved anywhere. 102 00:12:36,160 --> 00:12:42,830 In case you want to execute the same set of statements multiple times you would be better off to save 103 00:12:42,850 --> 00:12:44,900 the entire code in a file. 104 00:12:44,980 --> 00:12:53,010 Then use the Python interpreter and script more to execute the code from a file now in order to understand 105 00:12:53,040 --> 00:12:55,400 the interactive and script Mons. 106 00:12:55,410 --> 00:12:57,680 Let's go to the pythons. 107 00:12:57,710 --> 00:13:03,790 Ideally you haven't installed Python or any other I.D. yet. 108 00:13:03,870 --> 00:13:07,800 We will talk about the anacondas Jupiter note book shortly. 109 00:13:07,800 --> 00:13:09,430 So do not worry. 110 00:13:09,690 --> 00:13:15,210 But for now let's go to Ida and me on the windows system. 111 00:13:15,270 --> 00:13:21,250 Go to the start menu and search for IDA early in case of makeovers. 112 00:13:21,360 --> 00:13:29,210 Go to the terminal window and then type ideally. 113 00:13:29,650 --> 00:13:39,580 So here is the python so I D and E the three are all signs that you see here is called the python prompt 114 00:13:39,940 --> 00:13:48,270 which means python is ready to read and a new command by giving us that visual to also. 115 00:13:48,490 --> 00:13:58,510 It's the python way of telling us that we are in the interactive mode so let's print out some text using 116 00:13:58,510 --> 00:14:02,390 the print function say hello 117 00:14:05,710 --> 00:14:09,210 then hit enter as soon as I hit enter. 118 00:14:09,250 --> 00:14:13,840 The interpreter executed this particular audio statement. 119 00:14:13,990 --> 00:14:18,920 Now the idea league can also be used as a calculator. 120 00:14:18,970 --> 00:14:22,030 Say for example I want to add in numbers. 121 00:14:22,030 --> 00:14:23,890 These three numbers. 122 00:14:23,890 --> 00:14:33,290 So the interpreter has added all the three numbers and given is an output immediately. 123 00:14:33,300 --> 00:14:36,100 This is the interactive mode. 124 00:14:36,210 --> 00:14:41,400 The other mode that we have talked about is the script mode or the normal mode. 125 00:14:41,490 --> 00:14:52,980 And for that you need to put all your statements in a file so then go to the file and then see you. 126 00:14:52,990 --> 00:14:58,720 Hi and your I'm going to give a print function 127 00:15:01,820 --> 00:15:06,010 and put in script more. 128 00:15:06,350 --> 00:15:15,660 Multiply two numbers 20 multiplied by seven then do a division 34. 129 00:15:15,660 --> 00:15:27,850 Divide by nine again and we will save this by to save your playing mode. 130 00:15:27,940 --> 00:15:31,060 This code text Daud. 131 00:15:31,080 --> 00:15:42,150 B Why is the extension C now in order to execute this filing at the top. 132 00:15:42,330 --> 00:15:45,760 Put it run go to run module. 133 00:15:46,790 --> 00:15:53,090 I have three statements in the file these are the three statements. 134 00:15:53,320 --> 00:16:03,120 I have three statements in the file at FC but I only see one statement has been output by the interpreter 135 00:16:03,120 --> 00:16:12,510 in the script more that because in the script more in order to display any text or any statement or 136 00:16:12,510 --> 00:16:16,490 expression any value in the script. 137 00:16:17,130 --> 00:16:26,740 If you want to display something we need to use the print function this is not required in case or for 138 00:16:26,860 --> 00:16:29,380 the python's interactive mode. 139 00:16:29,830 --> 00:16:40,690 So now let's go to the same light and use the print function to do the math calculations and you need 140 00:16:40,690 --> 00:16:45,290 to see your filing in and then execute. 141 00:16:47,890 --> 00:16:52,510 Now now you have all of the statement in the file executed. 142 00:16:53,140 --> 00:17:00,360 So this is about the the interpreters mode interactive and script more. - Python for programmers