Anaconda Python | Python Anaconda Tutorial | Anaconda Installation | Great Learning

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
with over 25 million users worldwide anaconda is an open source individual edition which is the easiest way to perform python data science and machine learning on a single machine it is developed for solo practitioners it is the toolkit that equips the user to work with thousands of open source packages and libraries with the conda install command you can start using thousands of open source conda r python and many other packages conda makes it easy to manage multiple data environments that can be maintained and run separately without interference from each other hello learners i welcome you to all to the tutorial of python anaconda [Music] if you haven't subscribed to our channel yet i want to request you to hit the subscribe button and turn on the notification bell so that you don't miss out any new updates or video releases from great learning if you enjoy this video show us some love and like this video knowledge increases by sharing so make sure you share this video with your friends and colleagues make sure to comment on the video any queries or suggestions and i will also respond to your comments moving to the agenda first we will discuss what anaconda is then we will see the installation of anaconda and then we will see python programming in anaconda so we will start with variables then we will see different types of variable scopes such as local variable global variable along with that we will also cover data types such as string integer float and many more next moving ahead we will discuss different types of operators such as assignment operator logical operator arithmetic operator and many more after that we will discuss about inbuilt data structures such as list tuples dictionary and sets then we are having the concept of control statements in which we will be discussing about the conditional statement such as if else elsif along with loops and at last we will discuss the concept of function and how to pass information as an argument in function so this is the overview for this course so now let's understand what is anaconda so now coming to anaconda it is an open source distribution for python as well as r programming it is used in data science machine learning deep learning etc here anaconda navigator is a desktop graphical user interface or gui included in anaconda distribution that allows user to launch applications and manage conda packages environments and channels without using command line commands so now this is a formal definition in a simple word i can say that it is an open source distribution of python and r so basically you can use data science deep learning and machine learning in anaconda it is one of the most popular python distribution platform also user can install more than 1500 data science and machine learning packages as i already told you that it is used in data science machine learning and deep learning also multiple data environments can be easily managed as well as maintained and run separately without any intrusion so this is a basic idea about anaconda now after understanding what anaconda is now let's see its installation so now after knowing what anaconda is now let's see its installation so if you want to install anaconda you have to first install python right not only anaconda if you want to install any ide for python you have to first install python so what we will do we will install python as well as anaconda so now let's see the installation yeah so i will be using google search engine here and then i will go here and just i will write here python download and here you can see that you are getting the first website www.python.org if i'm clicking on this download python now you can see that this is the official website of python right python.org and here we are having several options like what about the python downloads documentation community success stories and many more so i just want to download the python so i'll just click on this download and here you can see that i'm getting the option for download for windows so i will just click on this and your python will install in few seconds now as i told you that i have to install anaconda too so what i will do i'll just write here anaconda and i will write here python so here you can see that this is the official website of anaconda that is www.anaconda.com so this is the website of anaconda and here we are having the several options like products then pricing solutions resources blog and company so here you can see the description about anaconda right so as i told you that anaconda is the easiest way to perform python and r right and if you go down then you can see that this is the features of anaconda right open source conda packages manage environment then here you can see that we are having the anaconda installers for windows for mac os operating system as well as linux so i am having windows operating systems so i will just click on this and download if you are having mac os and linux then also you can download anaconda so i'm using 64 bit graphical installer so i'll just click on this and here you can see that my anaconda is downloading so it will take some time to download so till then this is my python so let's see the installation of python so on clicking on this i am getting this option right install now and customize installation so i will just click on this install now and i will also click this add python 3.10 to path so on install now you can see that it's installing so here you can see that my setup was successful so i will just close it now it's time to install anaconda so i will just click on this anaconda and here you can see that i am getting welcome to anaconda 3 64-bit setup i will just click on next and then i will just click on this i agree and then i will just create install for just me then here you can see that i'm having destination folder so what i will do here i'll just click on browse and then i will click on make new folder and then i will just write here anaconda and then i will click on ok and after that i will just click on next so if you want to set this anaconda 3 to the path environment variable you can just click on this and then click on install right so i've already installed anaconda so once you click on this install button anaconda will be installed so after installing if you are going here and if you are writing here anaconda then you will see that i am getting anaconda prompt right so this is my anaconda prompt and here if i am writing here let's suppose anaconda hyphen navigator then you can see that my anaconda navigator will open so it will take some time to open so here you can see that i am having jupiter notebook i am having pycharm which is another ide right and then i am having spider 2 right so now if you want to do coding on anaconda so what i will do i will be using here jupiter notebook so i will go on search and then i will just write here jupyter notebook and here you can see that i am getting jupyter notebook option so i'll just click on this so after clicking on this you can see that my jupyter notebook will open so my jupyter notebook will look like this so what i will do now i would just want to create a new file so i will click on this new and i will click on python 3 and here you can see that my file has opened now i will change the name here so i'll just write here let's suppose anaconda i will write here anaconda basic program well it's a big name you can give any name so now let's see a simple program that is so much popular hello world so i'll just write here print and i'll write hello world so if i'm running this you can see that i'm getting output hello world so this is the basic idea about anaconda so we have seen the installation of anaconda and then jupiter notebook in which we are doing coding implementation so after seeing the installation of jupiter notebook we will see what are variables so variables are nothing but it is a container that is used to store data values so how to create a variable so variable is generated as soon as the value is assigned to it now so the next point we are having variable type can be changed even though it's set so let's suppose you have created a variable and it's of integer data type but you can change it to string data type right next point we are having variables are case sensitive so that means uppercase letter and lowercase letters will be treated as different so moving further variable name cannot be start with a number so you can't start a variable name with number right and also multiple values can be assigned to multiple variables in a single line in python so now coming to the last point same value can be assigned to multiple variables so that means you can assign the same values to multiple variables so this is a basic introduction of variable now let's see it in the coding part to know better so if you see the example here you can see that x is equal to 10 so here the variable is x which is having an integer data type now if you see here this is a y variable and which contains a string data type great learning right so if you will print x and print y then i will get 10 and here i will get great learning so this is my jupiter notebook i will go on new and then i will click on this python 3 and instead of untitled 22 i will write here anaconda underscore python let me save it so now let's start with variable how to create a variable so first i will comment it down i will write here has and then i will write here variable so now let me create a variable i will write here x is equal to let's say 20 so here you can see that x is my variable that contains an integer data type that is 20. so now if i'm writing here y is equal to great learning so here y contains the string data type that is great learning so if i'm printing it then i will simply write here print and inside that i will write x and similarly for y now let me execute this so you can see that 20 and great learning i'm getting in my output moving next as i told you that variable type can be changed even though it's set now let's see an example so let's suppose if i'm writing here x is equal to 100 and then if i'm writing here x is equal to let's suppose gl and now if i'm printing x so you will see here it will print gl so even though initially i have set x is equal to 100 that is integer data type and then i change it to gl so it will change it right so here you can see that the variable type can be changed even though it's set let me execute this you can see that i am getting gl right now after this next i have told you that variables are case sensitive so if i'm writing here let's suppose small x and if i'm writing here great learning and if i'm writing here capital x and if i'm writing here let's suppose gl so as i told you that case sensitive means uppercase letter as well as lowercase letter will be treated as different so here if i'm writing here print and inside that if i'm writing small x and after that if i'm writing print and capital x then you will see that i will get here great learning and then if i'm printing capital x then i will get gl so in this way you can tell that variables are case sensitive so moving further let's get some more idea about variable so as i told you that variable cannot be start with numbers so if i'm writing here 1 and then i'm writing here let's suppose 1x is equal to i'm writing here 10 and if i'm printing it then you will see that i will get an error so you can see that right it's showing invalid syntax now you can create a variable with alphabet so if i'm writing here x1 and let me change you to x1 and now if i'm executing you can see that i will get my output right even you can write the variable like this also this is also correct x underscore 1 and if you are allowing here 100 and printing it then you will get the output so now after seeing this what happens if i want to alert the multiple values in the same line you can do it so let me write here x comma y comma z and here if i'm allotting let's suppose 100 200 and 300 value respectively and now if i'm printing here print x let me copy and paste and now if i'm executing you will see that i will get 100 200 and 300 in output right so you can assign the multiple values to the multiple variables in a single line in python so now moving further variables are primarily of two types the first one is the global variable and another one is the local variable so what are global variables global variable is nothing but it is declared outside the function and it can be accessed throughout the program so here you can see the example this is basically a global variable how this is a global variable you can see that this is declared outside the function my function is this one right def tech and inside this function i am printing this global variable why because as i told you that global variable can be accessed throughout the program so here you can see that this is my function so how to create a function i will just write def which is a reserved word and then function name so let's suppose that i want to give the function name here as edtech right and after writing edtech i can also give the parameter right now after writing the function name i can also give the parameter here but i'm not giving here as of now now inside this function what i have done i have written pre in text so this is my global variable and inside the function i've written print text so it will print here great learning now so it will print here create learning but you can't print it directly you have to call the function so how to call a function so if you want to invoke or call a function then you have to call it with the function name so here the function name is edtech right so i can call a function with a function name so i will just call here at tech and whatever inside this function is there it will be printed so now let's see it in the coding example so let me write here global variable and i will comment it down with hash now after this what i will do i will create a variable that will be global variable so if i'm writing here x is equal to great learning so this is my x is equal to great learning now what will happen here i will create a function so how to create a function i will write here def and then the function name so let's suppose the function name is edtech and inside this function i want to print out my global variable so i will write here print x now after writing print text we can't directly print whatever is inside the function we have to call the function for printing anything inside the function so what i will do i will just call this function with the function name so what i will do here i will just write here at tech and now if i am executing it you can see that i am getting here great learning so always remember that global variable can be accessed throughout the program so this is all about global variables so now after understanding global variable let's jump into the local variable so what are local variables local variable is declared inside the function or you can say method and it cannot be accessed outside the function let's take an example here if you see here x is equal to great learning this is my global variable right so then what is local variable as in the formal definition as i told you that it is created inside the function so inside this function you can see that i have created a local variable y is equal to gl right now if i'm writing here print x inside this function then great learning will be printed okay and if i'm writing print y then this gl will be printed so now what's the difference between local variable and global variable so as i told you that local variable cannot be accessed outside the function so here you can see that we are inside this function def at tech so i can write print y so it will print me gl as soon as i am calling this function with the function name i will call this edtech so now it will see y is equal to gl right so it will print here great learning this is a global variable as well as a gl1 now if outside the function if you are writing pre and y you will get an error because we can access local variable inside the function itself so now let's see local variable encoding example so i will write here local variable and let me comment it down so i will use here hash and now after this what i will do let me create a variable and this time i am giving the variable name as x1 is equal to let's say gaurav so this is my global variable right because i didn't declare this variable inside any function now what i will do i will create a function so i will write here def and let me give the function name let's suppose edtech once again and inside this function i will create my local variables so let me write y1 is equal to 100 so a local variable is a variable which is declared inside the function so y1 is equal to 100. now what i will do inside this function i will write here print x1 and then i will write here print y1 so as we know that we can use global variable throughout the program so i am using global variable inside this function so i am writing here print and inside print function i am writing x1 and then i am printing out my local variable also inside the function since we can't access local variable from outside the function now after this what i will do i have to call this function so i will write here edtech so if i am executing it so on execution you can see that i am getting gaurav and then i'm getting 100 now as i told you that you can't access local variable from outside the function so what i'm doing here outside the function if i'm writing here print y y one right so on executing it you can see that we are getting an error why because we can't access local variable from outside the function it can be accessible only inside the function so here you can see that name y1 is not defined so this is the basic idea about global variable as well as local variable so moving further i have given you the formal definition of global variable that global variable is a variable which is generally declared outside the function now what happens if i want to declare the global variable inside the function so for creating global variable inside the function i will use global keyword so let me create here a function let's suppose def edtech is my function and inside this function if i want to create a global variable i will write here let's suppose global let me write here given now i have created my global variable with a global keyword now if i'm writing here g1 is equal to let's suppose 500 and if i'm writing here print and i will write here inside the function and i will write here g1 and if i want to call this function then i have to call through the function name so i will write here edtech so here you can see that inside this function i am having a global variable g1 and then i will assign the values even is equal to 500 now if i am calling it so on calling you can see that it's printing inside the function i'm getting 500 now as i told you that global variable can be accessed throughout the program right so it must be accessed outside the function also so if i'm writing here print outside the function and if i'm writing here g1 so it must give me the output outside the function 500 now let me execute this so on executing you can see that i am getting outside the function 500 so in this way if you want to create a global variable inside the function you can use the global keyword and then we can create the global variable inside the function so basically this is the idea about the variables and variable scope so now let's see data types in python so the best thing about python is that you don't have to specify the data type let's suppose that if you are writing x is equal to 5 so python will automatically understand that it's an integer value similarly if you're writing x is equal to let's suppose any string value great learning then python will automatically understand that it's a string value so we are having several built-in data types in python starting from boolean type we are having numeric types sequence types binary types mapping type text type and set type so in numeric type we are having integer we are having float then we are having complex in sequence types we are having list we are having tuples we are having range similarly for mapping type we are having a string and for boolean type we are having bool so now let's see this data type in coding example so let me write here data types and i will comment it down so now after commenting it down what i will do here let me write here x is equal to 5 so as i told you that in python you don't have to specify the data type python will automatically understood that x is equal to 5 it's an integer data type how if i'm writing here print and inside this print function if i'm writing here type and inside this type i will write here x and if i am running it you can see that it's showing class integer right similarly if i'm writing here let's suppose y is equal to great learning and then if i'm writing here print type and if i'm writing here y instead of x so on execution you can see that i will be getting a class as string similarly let me write here z if i'm writing here z is equal to let's suppose 100.678 and if i'm writing your print and inside this print function if i'm writing here type of z then you can see that i'm getting a error because i have to write here small t and here you can see that i am getting a class as float right so now let's see some list data types so if i'm writing here let's suppose w and if i'm writing here this is square bracket so as we know that this is the empty list right so if i'm writing here print and then inside this if i'm writing once again type and if i'm writing here w inside this then you can see that it will show me the class as list right similarly if i'm writing here v is equal to and this is round bracket so round bracket means i'm having an empty tuple if i'm writing one second here print and i will write here type and inside this type if i'm writing here v then you can see that i'm getting a class as tuple right so these are basically a data types in python so we can see that we are having a list data type we are having a tuple data type then we can have the range data type also and many more data types that i've already showed you in the slide deck so this is the basic idea about the data type so next we are having operators operators are used to perform operations on variables as well as values so we are having different types of operator starting from arithmetic operator in which we are having addition subtraction multiplication division and then modulus so this modulus will give us the remainder so let's suppose that if i'm writing here 5 modulus 4 so what will be the remainder the remainder will be 1 so basically this double asterisk is the exponentiation so if i'm writing here 2 and then exponentiation 3 so that means 2 power 3 we are having and 2 power 3 is 8. similarly if i am writing let's suppose 4 exponentiation 2 so that means 4 square is there so it will be 16 so now coming to this double slash symbol this is known as floor division so it will give us the value to the nearest whole number so let's suppose that if we are having 15 flow division of 7 then it will give me 2 value right so it will give me the nearest whole number now coming to the comparison operator we are having less than symbol we are having greater than symbol we are having less than or equal to symbol greater than equal to symbol then we are having equal to symbol and then we are having is not equal next we are having logical operator so in logical operator we are having and or or not so now coming to the bitwise operator we are having here zor we are having and or then we are having zero fill left shift then we are having signed right shift and then we are having not now coming to the assignment operator basically here we are assigning the value so if i'm writing x is equal to 5 that means i'm assigning 5 to x so if you see here i'm writing here plus is equal to so what does it mean if i'm writing let's suppose x plus is equal to 3 so that means x is equal to x plus 3 similarly if i'm writing x minus is equal to 3 so it means x is equal to x minus 3 similarly let's take an example of this modulus equal to so if i'm writing here x modulus is equal to 3 so then it will be equal to x is equal to x modulus of 3 right similarly for flow division is equal to and for exponentiation is equal to the same thing it will be here right so let me write here if i'm writing x exponentiation is equal to 3 then it will be x is equal to x exponentiation 3 now at last we are having identity operator so an identity operator we are having is as well as is not so this is the basic idea about operators so now let's see some operators in coding let's see some operators in coding examples so we'll start with arithmetic operator first so let me write here arithmetic operator so in arithmetic operator uh let me perform some operations if i'm writing here x is equal to 10 and y is equal to 5 and if i'm writing here print let me write here the addition of x and y okay and if i'm writing here let's suppose let me write here z is equal to x minus y so here if i'm writing comma and then z then you can see that i'm will be getting the addition of x and y is five so i'm doing addition right so let me write here x plus y so you can see that the addition of x and y is 15. similarly for subtraction you can write it here w is equal to x minus y and then you can simply write here print w then you can see that the subtraction of x and y will be five now what if i want to get the remainder okay let me change the value here let's suppose if i'm having here x is equal to 11 right and y is equal to five and as i told you that the modulus operator will give you the remainder so if i'm writing here let's suppose a is equal to x of modulus of y and if i'm writing here print so what's the remainder that we will be getting here we will be getting the remainder as 1 right now let me execute it you can see that we are getting the remainder as 1 so now after remainder let me see here the flow division so i will write here b is equal to x of then double slash here so if i'm writing here print of b then you can see that on execution i will be getting the value as 2 right because the flow division will give you the nearest whole number so if you're dividing 11 with 5 then you are getting 2 right the nearest whole number so the next operator that we are having is division so if i'm writing here c is equal to x divisible by y then you will see that let me write here print of c then you will see that we will get the output as 2.2 so these are the basic idea about the arithmetic operator so after seeing automatic operator now let's understand about the assignment operator so assignment operator is also simple one if i'm writing here x is equal to 3 and then if i'm writing here x plus is equal to 3 or let's suppose x plus is equal to 5 and if i'm writing here print x then you will see that my x will be 8 right because we know that this means x is equal to x plus 5 similarly if i'm writing here let's suppose x multiplication is equal to 5 so what will be my output my output will be x is equal to x into 5 and my x is here 8 so 8 into 5 will be 40 so let me print it out so if i'm writing your print x so you can see that i'm getting 40 here right so this is the basic idea about the assignment operator so next i am having comparison operator so let's see some comparison so if i'm writing let's suppose x is equal to 10 and if i'm writing here y is equal to 2 and if i'm writing print function and inside this if i'm writing x greater than y so we know that x is greater than y right 10 is greater than 2 so it will return us true value so you can see that i'm i'm getting here true similarly if i'm writing here y is greater than x and if i'm executing then you can see that i am getting the value as false right so this is the comparison and even if i'm writing here let's suppose x is equal to 10 and y is equal to 10 and if i'm writing x is equal to y so this is my equal to operator right so if i'm running it you can see that i am getting the true so this is the basically a comparison operator so now after comparison operator we will see here some logical operator so i will write here logical operator and if i'm writing here let's suppose a is equal to 20 and and then i will write here print function and inside this print function if i have given the condition let's suppose a is less than 20 and a is greater than zero so on execution you can see that i'm getting the false value why because a is equal to 20 so if i'm giving here let's suppose 21 then you can see that my a value is 20 and a is less than 21 right and a is also greater than zero so it will return me true now so on execution you can see that i'm getting the true value now another logical operator that i am having is or right so instead of this if i'm writing here or so or means at least one condition must be true in the case of and both the conditions must be true but in r if at least one condition is satisfying then it will return the true value so here if i'm writing here let's suppose a is less than 10 so we know that this condition is wrong right because a is greater than 10 but another condition is a is greater than 0 we know that right so as i told you that our operator will return true if one condition is true so let me execute this on execution you can see that i am getting the true value so this is all about the basic operators so now let's see what is list in python so list is basically a data structure and it is denoted by square bracket as i already told you and it's basically a collection of values with same or different data types so in a list you can have float value you can have integer value as well as you can have a string value too also if you want to fetch any value it can be faced through indexing in list we can also do the slicing so moving to the next point it is mutable that means value in a list can be changed so in list we are having several methods such as list dot append so if you want to insert or add any value so you can use append function so it will add the value at the end now coming to list dot pop so basically if you want to remove any element from the list then you can use pop function so now coming to the list dot com so count function will tell you how many times a value has appeared so these are the some methods that we can use in list so basically in list we are having a lot of methods but i have shown you some examples so now let's see list in jupyter notebook so let me write here list and i will comment it so let me create a variable l1 and as i told you that list is denoted by square bracket so this is my empty list let me insert some elements so if i'm writing here let's suppose score of and i'm right here admin let me write one more name here as tony and if i want to print this list then i will write print function and inside print function i will write here elven you can see that this is my list so as i told you that list is a collection of same data type as well as different data type element so here we can see that we are having only string values so what i can do let me create a list l2 and in this list i will give a name let's suppose gaurav and then let me give integer value i will write here 100 let me give let me write different data type so i will write here 100.345 now if i'm printing here l2 so an execution so here you can see that i'm having a list which contains string value integer value as well as float value so if you want to do the indexing in list you can do it so we know that the indexing will start from zero so this is at zero position this is at one position this is at second position so if i want to print only gaurav so what i will do here i'll just write here print and i will write here l2 and i will give the index position let's suppose 0 here so you will see in output i will be getting as gaurav yeah now similarly if you want to print out this value 100.345 then you just write here l2 and just write here 2 right because indexing will start from zero one and two so this is at second position so if you write here l2 and if you're writing here two and on execution you can see that i'm getting hundred point three four five so moving further as i told you that list is mutable so mutable means the value can be changed so let's suppose that at index position 0 i am having the value as gaurav now if i want to change it then i can change it so let me write here l2 so if i'm writing l2 and let's suppose at index 0 i want to change it from gaurav to great learning so here what i'm doing i'm changing the string value from gaurav to great learning and that's why string is mutable because we can change the value so at particular zero index position i am changing the value and if i am executing this list now print l2 so on execution you can see that i am getting great learning instead of gaurav right so now after seeing indexing and then list are mutable you can also do the slicing in list so what is slicing here so let's suppose if i'm writing your print and inside this if i'm writing here l2 and if i'm writing here 0 to let's suppose if i'm writing here 2 so you can see that on execution i'm getting the value great learning and 100 so what happens in slicing here it will include zero right so zero i am having here great learning and at one position i am having 100 but this two will be excluded right so if i'm slicing from 0 to 2 so that means the value at index 0 as well as 1 will be included so here you can see that this is my output so this is the basic idea about list so this is my list l2 right so if i want to add some value then which function cell i use so i'll write here l2 dot append so append function will add the element at the last so if i'm writing here l2 append and if i am writing here let's suppose 4 and if i'm writing here print l2 so here you can see that 4 has been added at last now so after this let's see some more functions in list so if i'm writing here l2 dot pop so we know that power function will remove the last element from the list so if i'm writing here l2 dot pop you can see that 4 has been removed so if i'm writing here print l2 you can see that 4 will be removed from you right so i have showed you some functions in list so this is the basic idea about list so after list let's see what are tuples so tuple is also a data structure and it is denoted by round brackets and in tuples also multiple values can be assigned with same or different data types moving further here the value can be fetched using indexing same as list so what's the difference between list and tuple in list we can change the value that means lists are mutable now coming to the tuple you cannot change the value so tuple is immutable so now moving to the last point let's see some methods that we can use in tuples we can use list dot count we can use list dot index so now let's see tuple encoding yeah so let me write here tuple and i will comment it so if i'm writing here a1 and we know that tuple is denoted by round bracket so this is my empty tuple let me insert some value inside this tuple so if i'm writing here gaurav and let me write here hundred and hundred point seven eight nine then after that let me write here three comma five comma three and if i'm printing it so you can see that this is my tuple so now so as i told you that in tuple the value cannot be changed so here you can see that a1 is my tuple right at index 0 i am having the string value has got up and if i am writing here a1 and if i want to change the value at index 0 and if i'm changing it to great learning and if i'm writing here print a1 you will see that i will be getting an error so here you can see that i'm getting an error because the value cannot be changed in tuple so that's why they are immutable now after this let's see some methods or some functions in tuple if i'm writing here let's suppose even dot count and inside that if i'm writing here three and if i'm running it then you can see that i'm getting the output too because as i told you that count function will give you the number of value that has been occurred so if i'm writing here 3 so you can see that inside my tuple i am having a 3 2 times so it has shown that 3 has been occurred 2 in my tuple so this is the basic idea about tuple so after saying what is list and tuple now let's see what is set so basically set is also a data structure and it is denoted by curly bracket right and in sets there cannot be duplicate elements so it is a collection of unique element and it never follow any sequence so let's suppose if you are having a set and you have assigned multiple values so the multiple values will not be in any order so it will never follow any sequence right and as i already told you that set doesn't permit duplicate values since there is no proper sequence you can't fetch the value using indexing also set supports union intersection difference and symmetric difference and now coming to the last point please remember that set is mutable now let's see set in coding so what i will do now let me write set here and once again i will comment it down so let me create a set so i will write here s1 and as i told you that set is denoted by curly bracket so let me write here curly brackets and let me write here some values 38 47 56 77 89 i'm just writing the random values you 90 and if i'm writing here 91 and then 92 so let me print this so on execution you can see that i'm getting the value so as i told you that set doesn't have any proper sequence it doesn't follow any sequence so here you can see that i have written from 38 47 56 77 89 1991 and 92 and here in the output you are getting 38 77 47 56 like this now as i told you that you can't do indexing in a set so let me write here s1 and inside that let me let's suppose that if i want to print out 38 values so this is at index 0. so if i'm writing here s 1 and the index position is 0 and if i am executing this let me write print here so on execution you can see that we will be getting an error let me print it out so i'm running it and you can see that we are getting an error because instead indexing is not possible because we don't have any proper sequence now so after this let's see some functions in set so let's suppose if i want to add any element in set so i will write here what's the name of my set s1 so i'll write here s1 dot add and if i want to add let's suppose 2 then i will just write here 2 and let me run it and after running it let me print my set so you can see that 2 will be added in my set now if you want to add multiple values then which function you can use you can use update so i will write here s1 dot update and inside this i can write 2 comma 3 comma 5 and now if i'm writing your print s1 you can see that i am getting 2 3 5 38 77 47 56 89 90 91 92 now here you might have a doubt that here i have inserted 2 comma 3 comma 5 then in the output why i am getting only one value of 2 comma 3 comma 5 it's because set doesn't allow duplicate values so we will be having only unique value in a set so now after this let's see union and intersection of set so if i'm writing a is equal to let's suppose 1 comma 2 comma 3 comma 4 comma 5 and if i'm writing here b is equal to 2 comma 3 comma 4 comma 5 comma 6 comma 7 and now if i'm writing your print and if i'm writing here a dot union of b then on execution you can see that i am getting these elements so what does here union means so union means basically all the elements of a and me right so here you can see that the elements of a and b are here now if i want to find the intersection so what does intersection means it means the matching elements of a and b set so if i'm writing here a is equal to 2 comma 3 comma 4 comma 5 comma 6 comma 7 comma 8 and if i'm writing here b is equal to let's suppose 4 comma 5 comma 6 and then 11 or 111 you can take any value 112 and if i want to find the intersection i will write here print a dot intersection so if i'm executing it you will see we will be getting the matching values right four comma five comma six so this is a basic idea about set so after understanding list tuple and set data structure let's understand what is dictionary data structure so dictionary is also represented by curly bracket but it is having a key as well as value pair so inside a dictionary we are having a keys and each key is having a specific value also if you want to do indexing in dictionary you can do it through keys moving further keys can be numbers as well as a string so that means your key can be numbers as well as a string keys are unique and hence immutable whereas dictionaries are mutable so it means that you can't change the value of key however if you want to change any specific key value then you can do it so here keys are immutable immutable means you can't change the value whereas dictionaries are mutable so that means the values of dictionary can be changed so this is the basic idea about dictionary so now let's see its practical implementation so let me write here dictionary first so i will write here dictionary and let me comment it down so what i will do now i will just create a dictionary variable so let me write a variable i will give any name even you can give any name so let me write here dictionary 1 and as i told you that dictionary will be denoted by curly brackets and inside this curly brackets we will be having keys as well as its values so let me write here key as 1 and let me assign here the value so this is my key and inside that i will assign the value let's suppose tony so this is the value of key one right whose value is tony now so let me write here one more key so i'll write here two and here i will write its value as great then i will write here three and then i will write here learning let me print it out so if i'm executing it you can see that i am getting this as in my output this is my dictionary right if i want to know the type so what i will do i will just write here and inside this screen function i will write here type and i will just write here dictionary that is the variable name dictionary one and if i'm executing it you can see that the type that i'm getting as class dictionary right so this is the basic idea about dictionary so as i told you that if you want to do the indexing and dictionary you can do it through keys so here you can see that we are having keys as one two and three so let's suppose this key third key is having a value of learning right and i just want to print it so how will i print i just simply write here print and then i will write here the variable name that is dictionary 1 and now this time i don't have to write the indexing position like in the previous case we were doing in list and tuples here i will just write the key so here the key is three right because i want to execute this specified key value right so that's why i have written here the key s3 so if i'm executing you can see that i'm getting learning moving next as i told you that dictionaries are mutable so let me change the value here so if i'm writing here dictionary 1 and let me write here the key as 1 and i want to change the value of this key so i will write here admin and now if i'm executing it print what's my variable name dictionary one right so you will see that tony's will be replaced by admin so on execution you can see that now at key 1 i am having the value as admin so hence dictionary is mutable so now in control statements we are having conditional statement so let's understand about first if statement so if statement is simple if the condition is true then the statement will be executed so let's take an example here you can see that a is equal to 5 and i have given the if statement if a is greater than 3 so here a is equal to 5 5 is greater than 3 right so as i told you if the condition is true then the statement will be executed so here you can see that the condition is true so it will print great learning now let's see it in the coding example so let me write here control statement i will just write it and comment it down and after this i will create a variable so let me write here the variable name as a1 and i will give the value let's suppose 100 and if i give here the simple condition let's suppose if if a1 is greater than let's suppose 50 then i will just write your print and inside that i will write here great learning now on execution you can see that 100 will be greater than 50 so it will print great learning right now if i'm having one more condition of if let's suppose if i'm having if even is greater than 30 and once again i am writing here print great learning so now if i ask you a question that how many times great learning will be printed the answer will be 2 because i have given you the basic condition and the basic condition is that if statement will be executed if the condition is true and the condition is that if the condition is true then the statement will be executed so let me run it and you can see that i am getting two times great learning so now after understanding if statement let's jump into the else if statement so what will happen in elsif statement so let's suppose your condition was true then we know that if part will be executed but when the condition is false else it will be executed so here you can see that in this example i am having a is equal to 10 b is equal to 10 and the first condition is that if a is greater than b so we can clearly see here 10 can't be greater than 10 so this condition is not satisfying so once again i have written here else if statement and i have written here a is equal to b right so 10 is equal to 10 right it's correct so this statement will be executed right so let me execute this so if i'm writing a variable let's suppose here a is equal to 100 and b is equal to 100 and now i will give the condition here so i will write here f and i will write here if a is greater than b then print great lakes i will give one more condition here elseif and i will write here a is equal to b and then i will simple right here print great learning so here you can see that this statement is wrong so if statement will not be executed and here if you see 100 is equal to 100 then it will print right so let me execute so here you can see that i am getting output as great learning so this is the idea about if and else if statements now so now after understanding if an else if statement let's understand what is else keyword here so this keyword covers everything that hasn't been covered in previous conditions so if you see here x is equal to 50 y is equal to 25 so here you can see that i have given the first condition that is y greater than x and is 25 greater than 50 no then i've given the second condition else if then i've given the second condition else if x is equal to y x is not equal to y also so this condition will not satisfy then i have written here else statement so here you can see that else keyword covers everything that hasn't been covered in previous conditions so let me write it into the coding example so if i'm writing here let's suppose a is equal to 100 and b is equal to 50 let me give the first condition so i'll write here if b is greater than a then inside this i will write print tony so this statement will not be executed why because b is 50 and a is 100 and 50 can't be greater than 100 i'll give one more condition else if a is equal to b i'll write here print admin so clearly we know that this will not be printed because a is not equal to b so i'll give one more condition here else and it will cover all the part which is not included in the previous conditions so i'll write here print great learning now if i'm executing it so on execution you can see that i am getting my output as great learning so this is the basic idea about the conditional statements such as if else if and else so now after understanding conditional statement let's understand what are loops so so loop is nothing but it's basically a repetition of a sequence of instruction to reach a certain condition so we are having mainly two types of loop the first one is for loop and the another one is while loop now coming to the for loop it will repeat the same statement till the condition is achieved so for example so here you can see that i have used for loops so i have written here for i in range then i've written 4 under a parenthesis right and inside this for loop i've written my print i now what will happen here if you see i is my variable right and here the range will take 4 values and the value will start from zero one two and three right so always remember the value will start from zero so we are having zero one two three total four values we are having right so this is a basic idea about for loop let's see it in the practical example so let's see for loop implementation here so i will just write here for loop and i will comment it down so first we will see here range so first we will be using here range function so i will just simply write here for i in range and if i'm writing here 5 and inside this if i'm writing here print i then you can see that i am getting values from 0 to 4 right so as i told you that if i'm writing here 5 inside this range function then the value will start from 0 right so that means 0 1 2 3 4 so inside that if i'm writing a statement print i then it will print 0 1 2 3 4 right so now let's see the for loop implementation in list so let me create a list here so if i'm writing here list1 so as we know that list is a collection of different or same data type so if i'm writing here gaurav i'm writing here 1 and if i'm writing here 100.5 so this is my list creation now what i will do here i will once again implement for loop so i will write here 4 and i will write one variable so let's take the variable name is x so for x in and then i will write here list one so what will happen here in this list one we are having three elements right that is gaurav 100.5 so x will take the value first as gaurav then it will take the value of 1 then it will take the value as 100.5 so what will happen here so inside this for loop i will write simply print x now if i'm executing it you can see that then you can see that the values in the list that is gaurav 1 and 100.5 are printed so in this way you can implement for loop in list now let's see the for loop in string so let me write here for and if i'm writing here x in let's suppose if i'm writing here great learning let me give the gap here also so if i'm writing a great learning and now if i'm writing print x so you will see what will happen here x will take the value as g then x will take the value as r then a then t then it will take the value as space then it will take the value as l e and so on so let me execute this so on execution you can see that i am getting the output like this so this is the basic idea about for loop so now after understanding for loop let's understand what is while loop so while loop is a loop which is having one control conditions and it will execute till the condition is true so let's take an example here you can see that i have created a variable a in which i have assigned the value as 0 and then i have implemented a while loop so i have written here while a is less than 5 so here you can see that inside this while loop i have written print statement and after that i have written a is equal to a plus 1 so what will happen here if you see a value is 0 here so 0 less than 5 right this condition is satisfying so it will print the value of a that is 0 and after that there is an increment a is equal to a plus 1 this is an assignment operator right so now a value will be 1 so now what will happen this is a while loop right so it will execute till the condition is true so now the new value of a is 1 so 1 is less than 5 right it's true so it will print 1 then once again a plus 1 1 plus 1 is 2 once again it will go 2 less than 5 yeah again it's true so in this way it will print the output so let's see it into the coding example so what i will do here i will write here while loop and i will comment it down so i will create a variable a is equal to 0 that means i am assigning 0 value to this variable and then i will create a while loop so i will write here while and then i will give condition while a less than let's suppose 10 and inside that i will write here print a and then i will write here a is equal to a plus 1 and now if i'm executing you will see that i will be getting the value so here you can see that i am getting my output from 0 to 9 so this is the basic idea about while loop so now after understanding 4 and while loop let's understand about the break statement so what i will do now i will just write here list one and inside this list let me write here great learning i will write here great learning then i will write here 100 then i will write here 100.5 and let me first right here break statement and i will comment it down so what i will do here this is my list now i will create my for loop so i will write here for loop so now let me create a variable so i will idea for x in list one and then what i will do here here you can see that x will take the value great learning hundred hundred point five so i will write here if statement i will write here if x is equal to let's suppose 100 then i will just write here break but before that let me print out some values so i will write here print x so now if i'm executing here you can see that first what happens here x will take the value of great learning right because x will take first great learning value then it will take hundred hundred point five so now x value is great learning it printed great learning here you can see that great learning doesn't is equal to 100 so it will not break since this is a loop so now x new value is 100 right so it will print 100 now it will see 100 is equal to 100 right now it will break so now the question arises what is break statement so break statement means you are going to jump out from the loop so here if i'm written here break so here you can see that i have given the condition so 100 is equal to 100 so now i've written here break inside this if condition right so here i've written break so it will jump out from the loop so it will not execute further so this 100.5 value will not be printed so this is the basic idea about the break statement so now after understanding break statement let's understand what is continuous statement so let me write continuous statement and comment it down so i'll write here continue and statement so let's suppose if you are going through any iteration and if you have written continue so once again it will stop that particular iteration and it will once again start a new iteration so let me show you with an example so what i will do here i will once again create a list let's suppose list1 is equal to and let me give you the values i will write here gl i will write here 100 i'll write here 100.32 and then what i will do here once again i will create my for loop for x in list 1 so here x is my variable and inside this what i will do i will once again give the condition if let's suppose if x is equal to 100 then i will write here simple continue now i will write here print and i will write here x but here you can see that the print function is not inside my conditional statement that is if it's inside my loop right so if i'm executing it you can see that i am getting zl and 100.32 so what happens here so as i told you that x will take the value of gl then 100 then 100.32 so now when x value is gl so you can see that if gl is equal to 100 no it is not satisfying so it will skip this conditional statement then it will print gl so after that the next citation will start and it will take the value of hundred now x value is hundred x is equal to hundred this condition will satisfy and here i have written the continuous statement so what will happen here continue statement will break this iteration and the new iteration will start so once again the new iteration will start here and now the x value will be 100.32 so now if you see 100.32 is equal to 100 no so it will print 100.32 so this is the basic idea about the break and continue statement so now after understanding conditional statement as well as loop we will discuss about functions so the first question is what is function function is a block of code that runs on invoking or calling we have already get some idea about function in variable right but once again i will explain you so what happens here if you want to create a function first you have to write the reserve word that is d e f and then you have to write the function name that is at tech so here the function name is edtech you can give any function name after this you can see that inside this function i have written my print statement welcome to create learning now if you are thinking that this print statement will execute no it will not be executed you have to call or invoke a function so how to call or invoke a function you can call or invoke a function by calling through a function name right so here the function name is attack so i will call it through the text so i will write here edtech that is a function name so as soon as i am calling through the function name attack it will go here and then it will see the statement inside this edtech function so here the statement is welcome to great learning and it will print so this is the basic idea about function so now after understanding what function is let's say it's implementation so let me write here function and i've already commented it down so now after this what i will do here first i will create a function so i will write here def this is my reserved word then i will give the function name so let's suppose function name is player now inside this function i will write a simple statement let's suppose print gaurav now if you are not calling this function and executing it nothing will be printed let me run it you can see that so how to print this print statement so i will call this function through function name so i will just write here player now if i'm executing it you can see that gaurav has been printed so now after understanding what function is we can also pass information into a function as argument we can pass list tuple dictionary strings into a function as an argument now here you can see the example this is my function right and inside this function i am passing information in the form of a string right great learning gl great lakes so i'm calling basically the function and i'm passing the parameter so it will print me there the name of the company is great learning the name of the company is gl the name of the company is great lakes so what i will do here i will write here function argument and i will comment it down now i will write here def i will write here player and inside that i will write here print inside that i will write here print and i will write here the player name is and i will write here player so this is the argument basically so what i will do here i will call this function so how to call a function by function name so function name is player so let me write here player and let me give that argument as player one right it will be good why because i'm already having the function name as player so there shouldn't be any confusion so that's why i'm taking the argument as player one so now if you want to call a function then you have to call with the function name so player is a function name and inside this let me write here dhoni then once again if i'm writing here yuvraj and if i'm writing here player kohli and on execution you can see that i'm getting the player name is dhoni yuvraj and kohli so so can you see that using function we don't have to write too much code right because if i was not using function then i have to write each time the player name is dhoni yuvraj and kohli but here you can see that we are passing the information and we are executing the same code again and again by passing the arguments so this is a basic idea about function so let's take a quick recap of this course we have started this course by understanding what is anaconda then we have seen the installation of anaconda along with that we have seen variables data types and different types of operators moving ahead we have also discussed the concept of inbuilt data structures such as list tuples set dictionary and we have seen control statement such as if else if else along with loops and at last we have also discussed about the function so this is the basic idea about this course thank you if you haven't subscribed to our channel yet i want to request you to hit the subscribe button and turn on the notification bell so that you don't miss out any new updates or video releases from great learning if you enjoy this video show us some love and like this video knowledge increases by sharing so make sure you share this video with your friends and colleagues make sure to comment on the video any queries or suggestions and i will also respond to your comments you
Info
Channel: Great Learning
Views: 6,528
Rating: undefined out of 5
Keywords: yt:cc=on, python anaconda tutorial, what is anaconda used for?, how to run python on anaconda, anaconda python, python anaconda tutorial windows, python anaconda tutorial for beginners, install anaconda, install anaconda on windows 10, python fundamentals, anaconda navigator, anaconda prompt, anaconda jupyter, python basics, python for beginners, python tutorial, introduction to python anaconda, python anaconda explained, python anaconda overview, python
Id: XdwkflC17DA
Channel Id: undefined
Length: 68min 32sec (4112 seconds)
Published: Thu Nov 18 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.