 So we will first discuss you can install python by this URL python.org and also very good documentation is available on this website. I will side by side show you the practical example also. You can run the terminal and just type python. So this is the python interpreter. It is an interpreter language. So in normal mathematical operations you can directly perform like any operation and it will give the results. And you can exit the prompt by control d. Now you can also write files as you write in c like .c extension. For python it is .py extension. And to make any file like normally if you will take example. This is a file run this file by python and then file dot the file which you have to execute. So it will show you the output. Also if you want to execute it like a executable file like how you execute the share script. So then you have to add this line that is hash. So it will provide the .exe file for python in Linux the executable file. So we will take a basic code and we will understand it. So I just wrote six lines and we will understand it line by line. So for comment in python it starts by hash. Anything followed by hash is the comment. And again like you have to assign a string if you take first line x 34 minus 23. So it calculates a value and it will assign the value to x. And in python you do not have to declare the variables. It is dynamically typed. For assigning the string you can type a string by either in double quotes or in single quotes. The meaning is same. For float value just decimal is required as you all know. And now double equal to is the comparison operator and the single equal to is the assignment operator. And plus it is doing the concatenation. If both are the strings then it will do concatenation otherwise it will add the operands. And to display the value on the command is the print command. Now as you can see I wrote print x and print y. So it printed the values on the different lines. Now if I want on the same line then you have to give comma. So it will just add a space after that. And when I first wrote my first line was x equal to 34 minus 23. So I did not declare what is x. It is integer or anything. So whenever I assign a variable, assign anything to a variable. In the first assignment it is declared. And then in the further assignments the reference will be changed. Because python treats every variable as an object. So it will assign different references to the object. And suppose if you write any division operator like z equals to 5 divided by 2. Then it will not take the float value. By default it will consider it as integer. And for float you have to assign it separately. And as I told for strings you can specify double codes or single codes. And if you want to assign multi-line strings then triple codes. And in the multi-line strings you can write if you have in your string any double codes or single codes then it will take. In python one more thing is very important. Like in C language we have braces. If you write any for loop then we start the brace. Then we write the function or the loop. And then we close the brace. In python the intentation is very important. If I write if x equal to equal to 3. Then it will give error. So it is saying expected and indent in block. So to specify that this print statement or any statement is inside the if loop. You have to give a space or a tab. So anything like how it knows that print y is outside the if block. Again the intentation should be maintained. If you are putting one tab for this print x. Then if you put two tabs then it will give error. So you must take care of the intentation. Like for the if loop I wrote the colon. Normally we have braces. So if there is any colon that it means that new block has to be started. So new block means you have to put either tab or a white space. To specify that that particular block is inside that block. Now what happens when we assign a variable any value. It only creates a reference. Because when first assignment is made it will allocate the memory. Like if I write x equal to 3. So what it will do? It will create the memory. It will store the integer 3 and create a reference and x. And that reference will contain the link to the integer value stored 3. And also garbage collection like Java it also handles it automatically. First assignment is very necessary. Like if you have not assigned the variable once also. Then obviously you cannot use it. And multiple assignments like x comma y equal to 2 comma 3. Then the first variable will be assigned to the first value. You can put any name except it should not start with a number. And some reserved keywords are there. You learn about them as I go on. Some data types in Python now. Normally like in C we have in Python also integer, float, strings etc. Now some additional data types they are tuples, strings or of course they are. But some modifications are there in strings. Now a tuple is an immutable data type. I will explain how it is immutable. The difference between tuples and list is tuple is immutable and list is mutable. And some syntax differences are there. Otherwise in list you can store like it can be of mixed data types. The first element can be of integer type. The second can be of string type. The list may contain an element as a list data type also. Or a tuple data type or string. And strings of course you know which we write in double quotes. And they are immutable. I explain about the immutable. So tuple is defined by the small parenthesis. So the elements can be specified by comma like 23 comma some other element etc. So you see that this 2 comma 3 is a tuple. So a tuple may contain a tuple also as an element or any other data type as an element. It may contain a list also. Similarly a list it is defined by the square brackets. And it may also contain any data type. And strings of course you can declare by the double quotes, single quotes. And in case of multiple line you can declare by the triple quotes. So if you want to access any element of the suppose I declare a tuple. Now if I want to access any element it starts from left side starts from 0. You can also access from the right side. And it starts at minus 1. So you can access both ways. Also like if I want to print whole tuple. Then either you can just write the name of the tuple or a colon. So it will display whole tuple. Also if I want that I should write the tuple from second element to the second last element. Then when you write like this then the number which is before the colon it starts from that number. And the number after the colon it does not go for that number just before that element. So just remember that also like if you want to write till the second last element. So it will start from the beginning and till the second last element. The same is applicable for the right side. You can start from second element till the end. Because it is starting from 0 so you should write 1. The same is applicable for list also and for strings also. Now you can also check if some element is present in the tuple or list etc is not. I can check if 3 in T. So 3 is present in T. If not then it will say false. You must be getting this very flexible language till now. We will use N keyword in for loops etc also which we will see later how to use it. And plus like we used for concatenation of strings can be also used for concatenation of tuples and lists. And if we write like tuple star 3 then it will repeat the tuple 3 times. And same for the strings and list. The concepts in list tuple and strings are similar except that tuple and string are immutable and list is mutable. So what is mutability? Now if like I have declared a tuple here. If I want to change the second element that is T of 1 to suppose 6. Then it gives error that the tuple object does not support item assignment. That is it is immutable. But if I declare a list and if I want to assign something to the element then it is allowed. And some other operations that are performed that is append operation. If I want to add anything to the end of the list. You can append any data type element. Also you can insert any particular position by the insert command. Suppose at the second location. Also semicolon is not required in python. Now we have two methods for adding something at the end of the list. That is extend and append method. In append if I want to add two elements then I cannot. Because it only accepts one argument. But in extend I can add by the syntax. So in append we can only add the immutable elements. Because whatever we add will be considered as one element in the tuple or list in append. Now if I want I can change again any element like which I recently added. Some other functions are there like index. You can find index of any element. You can count the number of occurrence of some element. And you can remove. And you can reverse the list by the dot reverse function. And the sort built in function is available. That is the sort function. And also a tuple can be converted to list and list can be converted to tuple. There are functions list and tuple. So in python many libraries are provided. You can just add the libraries, use the functions. So now as I said that it is object oriented. And it creates references to the value which we have assigned. So how does it work? We will see. Suppose I declare a variable. Then I assign the reference to some other variable. So when I write a equal to 3 then what exactly will happen? First the integer 3 will be created will be stored in a memory. Now the reference x will be created. The address will be of the memory allocated will be stored in the reference x. So that now x is referencing to the memory 3. Now when I write b equal to a then what will happen? It will copy just the same address value in b also. So if I change now 3 what will happen? Like the memory which it is referencing if I change it. Like in the case of list I append something. Then if I print it will print the same value. I mean b and a will print the same value because they are referencing to the same memory locations. However if I instead of a list which is a mutable data type. If I write a immutable data type like a integer value. And then if I change the integer value then what will happen? First we will understand it here. What happens when we assign it again? The memory location is again a new memory location is assigned for the new variable. Like first if I assign x equal to 3 here. Then I incremented x. So the incremented value will be stored at the new memory location. And then the new reference will be provided to the x variable. So the previous memory reference will be lost. And if we have assigned some value to the y. If we would have written here y equal to x. Then y would be still referencing to the previous memory location 3. So y will print 3 but x will print 4 even if you have changed it. So this is the case in the mutable data types. And if you have not assigned y anything to that memory location then it will be used for the garbage collection. The same concept is explained with the list. Now a very important data type that is dictionaries. It is a mapped data type. So it stores keys as to the value. And it is declared by the curly braces. And the elements are separated by the comma. Again it can be of mixed data types. Both keys and values. I will try giving a list here. Now the keys should be only of the mutable data types. So you cannot type a list in place of keys. It should be like only tuple, swings. But values are flexible. You can write immutable also here. Now there are several operations you can perform on dictionaries. If you write in packet if you write any key value then it will give the value of that key which we have stored in the dictionary. And if the value is not present then it will give a error. You can also assign a different value to a particular key by just assignment operator. But the keys must be unique because the values are identified by the keys. It is like an index. And suppose you add any new key. Like then it may be inserted at any position. Similarly you can delete a key by the del command. And you can clear hold the dictionary by clear. Now if you want to see all the keys then d dot keys is the function. All the values can be seen by d dot values. And each element is an item. So you can see all the items by d dot item. Now functions we can also declare functions like any other language. So the syntax is def. Def is the define short form of define. Then def then function name. And in the brackets you write the arguments. Then indentation is required. I mean one tab or one white space you have to give to show that it is inside that function. Then write the code and return statement is required. So that it will know that the function is it is returning after that statement to the column. And yeah so as new block is starting. So you have to give a colon after the function name in argument. Now as in C language you have to write up function prototype in the starting of the file. So in python it is not needed. So you can just define the function and call it. So as we have seen that just we directly write the variable and assign it. So it is using dynamic typing. And yeah of course you must be knowing that we can't coordinate two different data types string and integer. So it is a simple function. It has two arguments. The function name is my fun. X and Y are the arguments. We have defined the function as return X star Y. Now the function is called similarly as in other languages that is the function name and in packet the arguments. So it will return the value. And if you have not written any return statement then by default it will return none. So null is like null in C language and it is equivalent to false. And also like the prototype of function is not important in the python. Only the function name is important. So you can't have any other function name my fun and having some other different number of arguments or different type of argument. Because type is not matter in python language and number of arguments doesn't matter either. So function overloading is not supported in python. Operator overloading is supported because the data type changes of each variable. Now I have written two functions here. First is my fun and the applyer. Now the applyer is returning Q bracket X. It is returning a function. So the argument can be any function also. It may return a function also. So now like if I call the applyer function the Q argument has to be a function name which you have defined. So here it will be it is my fun suppose comma 7. So now if I call this function applyer what will happen? Ideally the score which is written inside the parenthesis should execute first because it has high preference. But here the function applyer will be called first because we are calling the function applyer. My fun is just and it is just like other variable like an object which is referencing to some code. So my fun won't be called first. Applyer will call and then my fun of 7 will be called and then the result 21 will be returned. So again we have two and false as the logical expression. Comparison operator like C only double equal to not and less than equal to. So this is also same like C, A and B. So both should be true. Either of them should be true in case of all. N0 is the if it is true then false vice versa. Yeah in case of complex Boolean expression you need to write parenthesis. Now like if the complex expression is there x and y and z then if all are true then it will return of course the value of z. And otherwise it will return the value of first false sub expression. So it returned 0. So how? Because first one value is false. So it will return the first of course the first expression is only z. So but if in case it was y then it would have returned the value of y which would be same again. So it uses, this means to say that it uses lazy evaluation. The first value which returns false it will return that it won't evaluate further. The conditional expression which we saw in C is like using and and or together. So we will go to the control flow statements if, while and assert statements. As we have seen the if statement, if and then condition, colon and then intentation. Now in case instead of else if there is elif. So it is else if. And again there is a else statement as same as C. And in while loop it is also similar like C. You assign a value then while and some condition colon and then give a intentation and the print statement. Break statement is there to break the loop and continue will go to the next iteration. Now assert function is there which can check if the condition is true or not. So if it is false then the whole program will stop. So like assert can be used to stop a program if the condition is not satisfied. Similarly for the for loops. Now we can use the list data type very effectively while writing the for loop. For example if we take suppose I declare a list here. I can just write this. So it will the x value it is like iteration. And the x will take each value which is present in the list. So first it will take one so on till x and will print the value of x. You can also use some range here if you want how many times you have to iterate the loop. Then range and some value you can write. So it will iterate for five times. So previously when we saw in it was used for checking if a condition if an element is present in the list or tuple or not. Now here it is used for assigning the value and iteration. And suppose if the variable which is used here is a string then it will iterate for each character. And whatever variable you have written will take each character value from the string. Wherein you have to process each character of the string and find something such string etc. And also if you have a tuple or a list then you can directly match if a tuple is present here or not. Like if I would have given here. So it will print each tuple. So normally you would have assigned it manually. So python does the job directly. As I explained the range variable is there if you want to iterate the loop particular number of times. So if you have written five then it will take from zero to four. Five would not be included. Some other functions are there like a lambda function is there. So you have any queries till now? Some of you might be actually you can try using python language for writing some mathematical programs etc. It's very flexible and easy to write. So default value you can assign. Like while defining a function you can also put default values. C equal to three. So if you don't give the argument it will by default take three. It won't give error that it should have three arguments. Also while calling the function you can use the variable and assign it and as pass it that way. It works in C also and multiple assignment. As we saw that x,y equal to 2,3 then it will take the first variable to the first value. Similar is the case for the tuple type or the list data type. That it will match each element in the order which we have specified. Like x will be matched to two. Also the element type should match. Like first is integer. It can be like integer or anything. But if you have specified it as a tuple and you don't have as a tuple for anything then it will give error. And that tuple should also contain two elements. Empty list and empty tuples and empty dictionary can be created. Because suppose where it can be used the empty containers. Suppose you are writing a program and you are adding something. You are calculating the values of a list and you are adding it. You want to collect all the values as a list. All the values which you have generated. Now if you directly append it then it will give error. That list doesn't exist. So you should assign data empty list before. Same the string operations. There are upper which will convert to upper case. There is a strip function which will strip of all the new lines. The percentage operator which we use in C language. The person D, person S, etc for string and integer. So that can be used here also. And also like to avoid the new line you can give comma. If you want to join some list. You have a list and you want to join the list as a string. Then there is a join function. You have to specify by which character you have to join each element. And similarly you can split directly on some particular character. It's very helpful if you like have a log file and you want to separate it. You want to find each every different column. Then you can just give a tab or a new line. And then split the whole file. And str function converts any integer or float into a string variable. So that you can concatenate. So if you want to import any header file in Python. There is an import command. And you can write your own files or classes or functions. And you can just import that particular function in your own file. Like if you have written some Python file. Let's see for example. We have written this a.py file. I will create one more file. So you have to like the file name is a.py. We will write here import a. So when you write it everything gets imported. All the variables or functions. Suppose we write a function here. So I just I should write a.myfunk here. So it will print the value which is written. So don't forget to write the file name and dot that variable. Now sometimes you might not if you have a very big file. And many classes many functions. You don't want to import everything. Then you just write from that file name. Only import some module. Some particular function. Like from the a.py from a import. The class name or some function myfunk. There is built in modules also. Like sys module and os module. So os module you can traverse the directory parts. And you can access all the directories and files in the os module. sys is used for like command line arguments. For accessing the command line arguments you have to import sys module. Then math module is there which math functions you can use then random. And as I specified you can include your own code files. So one example of if we use the sys module. We can add like a path sys.path is a variable. You can specify which path you want like pwt. You can get the current directory. So if you want to set something to your current directory just use sys.path and some path name. As a string. So how to define classes in python. A string or everything in python is object only. So class how to define it. Class then class name. Then all the methods or variables in the class should be again intended by one space or tab something. Then again you can define some functions or variables in class. So by normal function declaration. And there is a by default function underscore underscore init underscore underscore. So this is a default constructor which will be called if you create any object of that class. So like if you create any object of the student class. This is a student class. So you have to just write when you create any object in class name and in bracket the arguments which you have to give to the default constructor. And equal to whatever object name it is. And yeah like in Java we have this variable which refers to the self object. In python there is a self keyword for the same purpose. Yeah like if any object is there and you want to assign a value to its variable. Then you can just define a function and write self dot the variable name equal to the value. And whenever the variable is object is not used or then it will be automatically deleted by the garbage collection. You don't have to write free or delete statement. Yeah and any object name dot the variable name or function this is the way we can access it. And sometimes the problem is the attribute name or the method. The name of the variable is not known at the runtime. So what you can do just write get argument get attribute is a function. You can write the object name comma the name of the value you want to access. Because the object you might not know. Like if you created a f object here. Then you can access the full name variable. Instead of writing f dot full name you can also access this way. And you can check first of all if that argument is present or not by has ATTR. Now files. So for opening a file open command is there. Just open and the file name you have to write. And a file pointer will be assigned. Then to read the file there are two functions read or read lines. So we will use read line functions suppose for x in p dot read lines. So suppose the file contains many lines. So what x will do now it will take value of each line line by line. And then you can process each line. If you want to do any operation like if you want to split the words by space etc. Then just close the file by the close command. So it will save all the changes. Then you just want to kill the time by delay by delaying. Then there is a pass keyword. So it is like no operation in assembly code. There is actually lot more to study about in python. So like I specified file operations there are many things. Also regular expressions are there in python. So just study what it depends on the libraries which you are importing. So the more libraries you are importing the more kind of functions you can use.