Robot Framework Tutorial For Beginners | Robot Framework With Python | Intellipaat

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] robot framework is a keyword driven automation testing approach that solves the problem faced by other scripted automation testing tools it doesn't remove the need of scripting but reduces it to great extents robot framework implements the method of action words a set of keywords intended to make the arguments of certain test functions easier to invoke and reduce the amount of coding required for new test cases this video will take you through all such important concepts necessary to get skilled in implementing robot framework in various testing scenarios we will now look at the agenda of this session but before we begin please subscribe to intellipaat and hit the bell icon to get the latest updates from intelliback first of all we will begin the session with understanding what is automation after that we will discuss automation approaches moving further we will understand the basic functionalities of python and the concepts of python in unit testing moving further we will discuss selenium webdriver and finally to end this session we're going to understand how to read and write data using set frameworks and drivers so without any further ado let's begin yeah so so before starting i will just introduce myself and i just uh uh looked like uh what is the expectation from your end and then i we can get started into the post curriculum everything so myself vijay i am about 11 plus years of experience in a qa automation mainly so mainly i'm focusing on open source technologies like geometer tdd these approaches and uh i'm working with selenium apm on these things so here uh this part for intelligent i am doing this session so i have the course curriculum for you they have shared with me the content and everything based on that i'm going to so the prerequisite for this course is there is no explicit prerequisite required because uh but it is good to know know java because if we know java we can compare and do the studies or not only any other programming language then it is going to be additional thing but it is not mandatory because python is not going to be very complex okay then so this is the course we have the intellipet has given for so as first we may have the introduction about the automation approaches and other things then we will start with the python so as you are saying that yes robot framework is something like our default keyword methodology only keyboard driven framework only where just you are going to use some of the keywords and do it using know much programming is required but i don't know they have also included the python over there where we required some of the programming idea but as you are already aware of automation selenium with java so all the concepts more or less in python will be similar to java only only syntax wise there will be some changes and there are here and there some declaration part is not required like that small small changes only in python so comparatively python is more easier because uh java is where the compiler compiler and interpreter are getting performed but python is where only interpreter is involved so in that way the python is going to be compatible comparatively very less complex so that is fine and selenium web driver with python they have given so this is like the commands and everything related to your selenium as it is but instead of your java library i'm going to use selenium python library and there the syntax again the methods whatever you're using find element find elements switch to frames switch between the windows handling the alerts everything is going to be same but the way you interpret the command will be different because it has a this is a different library as a whole so in that perspective similarly calling the browser so those things are going to be different but other things like uh expert identification everything is has same as your selenium with the java only because element wise we can't do anything it is something related to an application for reading and writing the data you know in java you would have used file input stream output streams so here we need those kind of uh stream libraries are available instead we use an alternate approach similarly for excel there we make use of jxl or apache poi framework but here we are moving different sort of things over here we are going to use pycharm but one session i one automation we will be doing in the eclipse search the same other things are same where in your selenium java you are going to use page object model apm also you use that so here how are we going to define the page object model so because in java you know how do you create a constructor and how do we the page factory initialization you are doing all these things but here how it is going to be different that we are going to discuss and then we are going with the robotic framework so this is where we are going to download the rp idle and using that ide we are going to just to configure the test scripts and we are going to run it so here we will be discussing similar to selenium whatever we are discussing here the same information like handling the alert boxes drop down boxes all these things are discussed over here and how to generate the reporting and other stuffs are done here so this is how you plan that okay we will get started with the so this topics might not be required but still this is the plan for you so i have to go by that way so let me walk through that and then we will get into the basics of python okay so first let's start with the benefits of automation testing so automation testing you know as an automation tester still now you are working so process wise you are not going to make much differences so till now whatever the manual so you have worked on the manual end as well as on the automation so on the manual end whatever the operations you have performed the same operations only you are performing for automation testing where additionally one portion you are getting or one or one cycle or one step or one process you are getting involved what is that once as a manual tester you prepare a test case you are filtering the test cases so say manual test cases 100 cases you have written means then you go through the manual test cases you want to identify what are the cases could be automated so then you are automating the scripts or automating that application and creating test automation scripts that can be opened to qtp or selenium or apm or anything so that is where the automation testing is different so automation testing as you are aware it is not going to be something which is going to do everything on automatically but it is going to follow the instruction provided by the automation tester so we are going to provide the instruction how do we provide the instruction that is where we are using the scripting languages or programming languages based on are feasible for each and every operating system or each and every automation rules for example in qpp the instructions are provided in vbscript if i go with selenium with java the instructions are provided with the java kodi core java language so in selenium with python we are going to write the python step so automation testing is a technique where we are going to use some sort of automation tools in order to replace the user operations so instead of a manual user sitting and performing an operation let the tool do that but for that tool i am going to give the instruction priorly how the tool has to do it how much time it has to take it what is the step-by-step operation that tool has to do everything so what does the reason we are doing that means as a process now everyone is following the automation testing that is well but what is the main reason we follow automation testing means now the most important thing is repeatability so as you are working in the real time you know mostly we work with the when you are into service based companies or service-based projects like banking or insurance so those are very long time projects morally you will have a contract of five years or seven years contract so those on a monthly basis they may give some change request or a new request so where you are updating everything now you can take even gmail itself you just think of a gmail scenario so like around 10 years the gmail has been in place but whatever the default concept of gmail which was during the time of inter interaction that the same remains now the inbox composing drafts everything else so now when they have introduced or when they are upgrading it to a new technology or anything they need to make sure that the existing components are working so for that we need to do a regression testing so regression testing may have around in a real time you know for each and every application thousands of test cases are going to be there to overcome that situation we are going to have this changed of cases so repeatability is the very important reason that is the most even though uh as uh even though we say multiple things as a benefit but most importantly as a automation tester in the real time the repeatability is the main factor we consider and then about the time so consumption of time you know as automation tester it consumes the time but not from the perspective of writing the test cases it consumes the time from the perspective of execution so when you use ciecd tools like jenkins or teamcity you don't want to wait for the enabled deployment or anything you just mark it so as soon as the developer maps the build a new build is deployed on a night or on a timely execution it is going to run and you will get the reports so mostly all the regression switch we will map it towards tonight when i am leaving the organization we are going to do that so there is no manual intervention required as well as there is no process like a manual user should be there to invoke the scripts or anything else but the most important thing about this is ensure consistency and reliability in results so the meaning of reliability and results is you know as a factor so when we are as a manual tester when we are doing level one testing level two or you consider you are doing a testing in qa environment and staging and uit environment there is a possibility where one or two test cases may be missed or they may be skipped in an assumption that it will it is not it will work because that is a major uh uh complex test case like that or it is a easier test case so like that there is a possibility where as a manual user you can skip but an automation script is not going to skip anything unless you intentionally go and do that right it is always going to execute line by line only as a code they are having a sequence where it has to execute line by line so any of them are auto skipping or nothing can be happening there so uh results wise i can rely on the tools because it is going to strictly follow the instruction provided by the automation tester consistency wise also so today it has taken a 1 hour for execution tomorrow also plus or minus 5 not more than that and similarly today it has executed 700 cases means tomorrow also if the application is possibly fine and with no errors or with no show stoppers then it is going to take the same amount of time on the same line benefits of automation testing but when we see the other side of automation testing there are some factors involved even though you may justify it saying hey i'm using an open source tool so i'm not charged with any licensing cost anything right well i'm good but if you see a selenium with java you people are using but most of the organization like if it is a product based organization mainly they don't rely on open source so even though your application is created in java they still rely on intellij because it provides major functionalities like configuring the svns git directly over there and it provides some sort of security jet drawings so it itself is there providing the community edition as well as the commercial addition also but we prefer to go with the commercial edition so in that also there is a cost involved and compared to any other tools when we go for open source tools the market is huge so the automation test as demand is also high so cost wise we may say that uh from the wider perspective say it decreases the cost but uh definitely it is not like that it all together it is decreasing the cost because the time is reducing execution time is reducing because of that because uh the testers mostly are charged on a hourly basis so it is getting compensate that's all i can say but i don't uh at any any point of time i am i am not ready to agree that that at this point like uh cost wise we are getting very efficiently in automation testing because it is not true as you know very well so why automation as we are aware of that so the first and foremost thing as your everyone has worked in automation the most important thing is we as a industry when you are working you will do the testing on multiple levels like first when the development is done it will be moved to the qa environment so first level zero or qa environment testing has to be done so in that identify the major defects and get it isolated fix it once all of them are fixed then it has to be moved to the staging environment so there again level one testing is done so where you identify the next level of books so once again if you fix that then move it to the id environment or pre-production environment again so like that multiple levels of testing you will do so that will increase the coverage of testing so that is one aspect and the other most important thing is if you are having multiple application servers like you know google dot co dot nes there google dot co dot uk is there similarly yahoo similarly any application if they are deployed in multi global global occurrences say they have set of functionality sames but according to the region the results and other things may vary so for that i cannot create another automation scripts right so the default we just update the url and we will be running it and the other most important thing is software testing does not require human intervention which is as i said overnight execution we are going to do it increases the speed of test execution it increases the speed of test execution means we cannot do anything on the application end to make the application faster and it is not realistic also if we are doing like that what do we mean by increase the speed of test execution means uh we can consider from the perspective of prerequisites and post requests for example when you want to do a prerequisite for your manual testing what are the things you do yesterday you may have done the regression testing so you have to clear the databases flush out the data if you need you have to create the data like that prerequisites are there post request once you have done all the activities you have to close the connection with the database you have to close the files all these things and you have to if there are any batch process has to be started you have to stop that like that so in that case in when we are going for automation we can write that files or we can call the batch files at the end of it or in selenium with java itself you have the before sweet and after sweet where we can write some of the cases which has to be done after the suite is completely ended so like that so in that perspective only it is the speed of test execution is increased not from the perspective of interacting with the application because interacting with the application it requires the amount of time to be provided for the application to perform the operation i cannot make fast the application because the application may not be able to complete the operation what it is supposed to be automation helps in increased test coverage how it helps in increased test coverage again this is not based on the automation tool it is based on the automation tester so we have to cover most of the scenarios and based on that only we can completely cover all the testing part so this part we accepted because you know as a manual tester when level zero we find one or two defects and we re test it on the level one we will be lethargic you know that because already in level 0 no errors are found so how can be the same build only they have deployed again so we may skip some test cases that is what they are saying here which test case to automate so as a tester so i don't know which process you people are following or currently we are in agile so for example there is a scenario uh for me there is a user story provided for this week for the sprint so based on the user story the manual tester is going to prefer the test cases you know in agile documentation are not important but still they will be providing the high level cases from the high level cases i am going to identify the critical business scenarios which may require to test in all the builds or which may require to test every time whenever there is a change in a particular module or particular application so identifying those kind of critical modules and check the possibility whether that can be automated or not so that is the first case which test cases means first one is complex that is complex in that sense not about the operations you perform the complexity of the business and how that case is impacting the application and also you can identify the test cases which are tedious or which is difficult in order to perform manually for example in a simple way you want to do a registration after a registration successful message is done you want to write a query in the database and try the data and you have to compare the data whatever you have registered whether it is available means yes you can do it but it is like a process where you have to execute multiple queries manually retry one by one record and you have to compare it front end and the database so that can be automated because that manually it is going to take some time because you have to run query one by one for each query execution it is going to take time and manually you have to compare the things whereas instead of that if you are using a string comparison it is going to be easier and what are the cases is not suitable for automation as automation tester you should be aware of that now test cases that are newly designed are not executed manually at least once the reason is the most important factor of automation is stability when application is not stable we never consider it for automation right because when the application is unstable suppose consider you are automating a selenium application the element is keep on updating how many times you can go inside the object repository file or inside the script and make changes related to that right today there is a field called the gender male female it is a radio button tomorrow they are changing into a drop down so how many so a drop down means you have to use select queries if it is a radio button you have to use list find elements and based on that you have to identify the value and spec so now the logic itself you have to edit so when they keep on changing like that you cannot go for that so the stability of the application is important but that can be any kind of tool not only for selenium even qtp the same problem when the object repository is captured and stored now the object changes qdp also will not recognize that and test cases for which the requirements are frequently changing for example you know the gmail functionality before three or four years if you take functional device there is no major change but the login screen wise there is a change you may know that before three years you have to enter the username and password together and then you have to click on the sign in but now first you will enter a username and click on the next button and then it will prompt for the password so functional wise if you see if the user name is correct then our username is valid then only it will ask for password but earlier it was not like that so here the requirement is a little bit changed so in that case you have to insert a new line of code to make sure that you are hitting on the next button so like that in that case is also automation is not this will not be a suitable option test cases which are executed on a hard dark basis basically you know that in a manual testing you do monkey testing exploratory testing add-on testing but these cases we never automate we automate either with the functional test cases or regression test cases so exploratory testing is to ensure only whether the application is suitable so whenever we start the application to automate we may do it but other than that add-on testing or exploratory or monkey testing we never automate so these are the things so this is a testing process so uh i um so basically this testing process will not be experienced by everyone because we when when we are moving from manual testing to automation testing we may first get involved in the execution process and then we will be moving to uh enhancing the script or revamping the script and then we will start working with the script but actual process of automation is little bit different so where it is a cyclic process so consider that an application is released or an application is completed development and it is given to the testing means assume that there is no existing framework or existing automation approaches available in your organization then this is the process we follow the first and foremost thing is for that application before this test tool selection there will be one process we will have which is called as factors to check for automation so whenever an application is given so we will test three factors for the application whether this application can be considered for automation as i earlier said one is stability of the application and the need for automation under the level of execution because so from the beginning whenever we discuss about automation testing everyone says a point like time consuming process manually so when go for automation it is very faster but is it really like that means no automation is a time consuming process because we have to prepare a script execution wise it is very faster so it is able to compensate the entire time so but when does that execution is faster because of that we are compensating means when is it possible means when the level of testing is at least greater than 3 or something else for example if it is an application like e-commerce site means we have to do multiple testing because we have to do a functional testing system end-to-end testing we have to do system integration testing we have to do because uh stick amazon so amazon has multiple features enabled to that because it has a seller login buyer login and you have a finance domain where all the product prices everything gets involved so that is from the other aspects so then i want to do a end-to-end testing it is like i have to log in i have to purchase a product and then i have to log into the finance module and see whether the cost is added whether the quantity is decreased whether the stock is decreased everything i have to verify so in that case multiple levels of testing is proposed but if the same take some applications like uh just information providing websites like a company website or something so that and all not having much complexity and those are not required for automation at all because those are one one-time activities so once you test it and deliver it that's all after that maybe after five or six years the same customer will come for upgrading the site so during that time we may use a different technology or something so those things cannot be automated or need not to be automated and then need for automation means we have to think of what is the need for automation how many test cases say 120 only can be automated means is it a good approach to choose automation here or your application you know as you are four or five years working on automation you know that still now we cannot automate capture images otps we have a workaround for that that is different but still now the reality is we can do that so if your application is having multiple odps related things then we cannot go for automation so that one is and then the stability as discussed in the previous point stability if the application elements are keep on changing so how can i consider it for automation so when these three factors are convinced then we can go for the next thing so assume that the tester tool selection it includes three factors again what are the factors means one is the licensing which is roi return on investment so based on that only they will identify for example the testing cost you may know that 60 40 is the priority we provide right 60 for development 44 testing so the in this 40 percentage how much i am going to purchase for licensing cost so should i go for a licensing tool or not so that we need to identify that is where the first tool selection depends on the return on investment and then it it depends on the resources so suppose i am not uh able to choose licensing due to budget because of that i am going to choose the open source means do i have enough enough resources who can work on open source if i don't have enough resources do i have time for them to provide the appropriate training and get them involved so considering these three factors only you can be able to select a two so once you select the tool immediately you cannot start the automation you have to define the scope for automation so how do you define the scope that is where you are isolating the cases for automation so just by isolating the cases you cannot do it so during the scope of automation here you prepare poc proof of concept so here you have selected a tool called qtp now under the scope of automation you have identified minimum of 70 percentage can be automated but i am not sure whether this application is suitable with qtp so that is where the poc comes so the poc is where you take one complex module prepare the test cases for it choose a framework for it like it can be a data driven or keyword or anything and implement that for this complex module alone so prepare the framework for that particular one and run it generate the reports showcase it or demo it to the customers or the end users or the management to make sure that whatever we are expecting is available with the reports and this is how we expect the automation to run if it is fine then we choose it to this framework suppose you are automating this application you started automating 50 percentage of the automation is done and there is a ajax window coming or there is something which is popping out which cannot be automated with qtp means then that's all our poc is failed here so we come to the conclusion a qtp cannot be used so choose an another tool so similar to qtp vbscript which is the other tool supports vb script because i have engineers who are good with vbscript only what is the other tool available what is the licensing cost associated with it so assume that qa wizard pro is another tool available for vbscript specific to dot net application so does it licensing cost what is that so it has only 40 000 as the licensing cost single seat okay then we can go by that so like that only the process goes up so once this framework is 100 percentage implementable and success and the reports are convincible then you start with the test case actual test script preparation and then you do the test execution report generation everything and finally you maintain it but nowadays you know as a as a part you are getting directly involved in this particular process only very rare where we get chance to get involved in preparing from the scratch because already the framework may be developed or it may be ready available mostly nowadays what we people are doing is there is an amount of time taken for preparing the framework so we rely on independent testing companies there are available so we uh hire them just for preparing the structure of the framework so they prepare the structure of the framework and provide it to us from there we start implementing our test cases this is how it goes on so this is about the tool selection and different tools available in the market as i said tool selection is something which does not depend on our skill set alone it depends on the project budget it depends on the availability of resources it depends on other factors as well like whether this application is suitable for this or not the reporting is satisfied or not considering all this only we will come to tool selections scope of automation so what are the main points for example we generally say yes 70 percentage of the cases can be automated 60 to 70 means then we go for automation but what is that 60 to 70 percentage that should be important for business so that 60 to 70 percentage should not be like just selecting or clicking not like that a business flow for example take a uh amazon so it should be like adding to the part not just searching for a product if there are ten test cases related to that searching for a product in a household searching for a product in electronics that alone will not be desirable that should be the core functionality of the business like adding to the card when i do the cancellation what is happening so like that and the scenarios which have large amount of data mainly with the bankings so when we are working with not even bankings if you take any supply chains like uh transverse that is like a container movement container transfers so there are going to be thousands of containers in millions so if in those cases if i want to validate then we can automate it because we cannot have those lists common functionality across application which is like mostly this case comes under like when you are working with the global applications where the functional device they will be same but application wise for example we use a brand uh called acer laptops here but when we go to us or something the same esr laptop but they are selling it under a different brand called a packet bill or gateway like that but all of them have the same customer centers only across the world so their customer center application will be the same but they have different information so those kind of applications technical feasibility you know about it just a quick info guys if you wish to learn testing and make a career in it then we have a good news for you intellipaat provides test architect master course in collaboration with ibm and microsoft the course link of which is given in the description below now let's continue with the session and what are the components to be reused and other things cross browser test these and all you know mainly on the selenium part what is the purpose of using test ng parallel execution and grid you will be aware that why cross browser testing is important so this again about the design and development so here so as already you have worked you know the importance of framework so the frameworks are not only just specific to selenium or apm so generally in qpp also we have all the four different types of framework in testcomplete also we rely on frameworks so the only additional thing you have in selenium is page object model but similar to that qtb has its own automation object model uh available with that where we relay or we where we categorize them also page wise only so everywhere the framework is used the main importance of framework is again i don't want to spend time in classifying the categories or classifying the code so i should be able to write the test cases for a new application immediately i don't want to initialize the driver i should not be able to call the or writer logic for reading the excel reading the config file or printing the logs generating the reports all this again i don't want to deploy so in order to avoid that only the framework comes where all these are pre-determined like you have written how to generate logs how to generate external reports how to generate a or how to read a config file how to read a excel file or how to do an operation like a click or select how to do a delay weight that can be a explicit weight saying for element to be clickable or how to switch between windows everything you have written but now i am going to say the test case hey do all this operation on application xyz so that is going to be easy for me so that the prerequisite are the major things are already done so that is where the framework part comes so these are the four different types of framework you use data driven where data is going to drive the test for that in selenium you do it in two different ways where you can write the linear script and implement the apache poi concept and you can automate it the secondary one is you can use the concept of data provider and you can do it so that is where you achieve data driven framework keyword driven framework again you are going to define the keywords for each and every unique operation that can be anything of your own for example wherever you are about to enter a value in a text box you can provide any text enter text wherever you want to do a left click you are going to come up with the keyboard modular automation framework is nothing but breaking into smaller composition or decomposing it breaking into smaller components where instead of creating a huge amount of scripts inside a single module or a single method you are going to split them into equal parts or into smaller components and the most disadvantage about the modular driven is modular driven framework mostly we hard code the data inside hybrid is where combination of modular with keyword or modular with the data driven like that finally this is the difference between manual testing and automation testing so you can go through it but only the main points i will be highlighting here automation testing uses automation tools where here manual user is involved and automation does not allow random testing whereas manual testing will allow random because automation tools are like coding only they can execute line by line only so here it is not possible to do random testing because you have to specifically say which part which mode or which code i have to run and here if you see not cost effective for low volume regression this is the most important so not cost effective because till now what we are saying is it is a cost effective cost effective but when it is cost effective means it is a very high volume what do we mean by volume means when the number of test cases is also more and the service period of the project is also so from that perspective only it goes on and [Music] the most other important factors apart from for parallel testing and other things what i feel as a most important thing about automation testing is cicd putting into the ci cd because where you no need any manual intervention because i know before the ci cd tools came into picture what we have to do there will be a release engineer so the developer will say i have done the coding these are where my code or my files are available so religious release engineers will collect all the files and he will deploy it and he will say the deployment is completed you can start the test then i will trigger the automatic testing code that will get executed but now no one requires whenever developer commits its code the git will say to the bitbucket there is a new commit happened or it will communicate to the jenkins saying that there is a new commit happen so there in the jenkins we would have configured whenever there is a new commit you have to trigger the automation suite so it is going to that that is the most important of our important advantage i see in automation testing these are some of the basics which you may be already aware of but just for the covering the course content i am doing it billable resources so though they do not consider about the project cost they consider about the resources okay i need 10 resources out of that three manual resources three automation resources three uh or one or two devops engineers and one manager so they hire the resource perspective super resource they will be paying on a hourly basis they will calculate okay per month i need 160 hours totally that you can split across any any anywhere so that is how but as a product if you see 60 40 is a almost followed that because that 60 will not alone go for testing because development it goes for requirement gathering and there is architect who design it who come up with the technical design document like high level design and low level design and algorithm is done and then similarly when you see the testing 40 percentage when we say it has a qa it is not entirely the qa cost 40 percentage goes for the qa the devops engineers release and maintenance engineers support alone will be excluded so let us start with python so python as uh earlier i said it is basically a high level interpreter language only it is not like a compiler and other things the meaning of interpreter languages you may know that in java what happens is you write a code maybe on the 15th line of your code you will have error okay but can you run the code a remaining 14 lines are fine but it will not the reason is the compiler will first compile the code and see whether it is out of compilation issues when there are no errors then it will allow me that is where the interpreter gets involved but when we say python as a interpreter language the meaning is up to 14 line you can execute it it will execute the 15th line is where it cannot execute what is the purpose of interpreter there interpreter is nothing but it requires the code whatever i have written in order to convert into a machine readable format and then it will execute that is the only road so the first line if it is properly converted it will execute and the second line it is properly converted it will execute it and the 15th line if it is converted when executing it is getting an error it will throw air so that is where the python is different from java where it is highly or high level interpreted language and the syntax way is very very here there is no much complex at all like uh hard and fast rules like we have there like we should start with the flower parenthesis end of the method should be given with the closed mostly in python we don't use parenthesis and the flower brackets and other things so the syntax wise also it is going to be very easy so this was the person one who is created that widow also around 1989 itself you remember here this is what even when i started learning i was very much like you people i also had a thought okay selenium we know abm you know j meter we are doing but why this python part alone we are leaving it and everyone is asking for this so when i started reading i was just shocked to see that python was available from the year 1989 it is not something like a new language like any other things ruby on files or anything earlier that uh we now what we call like a machine machine learning these things we say right so python was already available but it was taking consuming more time from the perspective of executing so that is the reason people did not show much interest on that but in now in the later factors what happened is when the machine learning and other things came which are enabling the execution faster those made the python execution is also faster python wise they did not make any change but the external factors like machine learning and a these kind of techniques whatever they are implementing that made the python to be executing faster in the real time so that is where now the python came into the market so as of now currently if you see the python the most important thing about python why it is very familiar or what is the reason it pro it is very famous in that sense means first of the easy syntax and the second thing is like java this is also available of free cost and the most other important thing is java also capable of creating web applications mobile applications and plugins etc etc right but in that also we have a classification for example if i want to create a core application then j2 ac is required when i have to go for a mobile then i have to go for micro edition when i want to go for application servers and other things i have to go to j to double e enterprise edition so like that we have multiple variations but here python as a single it is capable of supporting web application mobile application plugins web servers etc etc so there are no flavors like the in java we have multiple flavors another most important thing about python is library support like in java we have libraries for example i want to read excel we go for apache ui i need a json so we either go for a google.json or we go for word json so where we are provided with multiple libraries so similar to that in python also we have this kind of libraries and other reasons why mostly this python it has been used in a real time or how it has been used in real time means the first thing is simplicity where we have the syntax not only syntax execution is also simple and it does not have any configurations much configurations or anything else like if you go for visual city and all there are lot of configuration etc and as here it is open source portability because it it is also like available across different platforms like java so the code whatever you are writing here as it is in mac you can run it and it is interpreted where it is getting converted the mission readable language it will get converted so you don't want to do anything but in java what happens is compiler is the one which will compile and send it to the interpreter and libraries there are huge library support available like in java you can create your own library other than that inbuilt there are default libraries available on another most important thing is like java this is also an object orientation is provided which is like python is also considered to be the part of object oriented language so now where in current industry standards are in the current perspective where python is used means mostly python used in all the organization mostly in google they are using and we think the torrent is in bittorrent is using even netflix uses but when we say they are using they are using means what is that they are doing with that google so are they developing the ui with that netflix are they developing means no what they are doing here means the algorithm search algorithm is written in google uh just python so because the search algorithm requires the fastest way to search and provide the information across multiple servers it has to do so that has been implemented using python similarly if you go to the bittorrent what is that it does in bittorrent is uploading and downloading of files encryption and decryption all these things are written in python netflix what it is doing means mostly in the netflix you may observe when you log into the nest netflix it will show before you choose any programs it will show like uh you have watched this so these are the options for you like that it will show the meaning of that is it is collecting the previous information from you so you select a particular movie today to watch and you have completed watching it that information is stored in the netflix that interrupt information is taken by the machine learning and it uses that as a keyword and it refreshes it refreshes the entire uh whatever the available categories using this keyword suppose this keyword is related to romantic or this is related to suspenseful so then it filter it and from the suspenseful it com compare with the actors available so based on that it provides all these happens in a frequent of time so that is where the netflix uses it like that multiple even this claim that nasa uses it but i am not sure about on which perspective but on a high level they say they uses it for some higher end calculation that is very specific calculations related to launchings this is where they call they use it so these are some of the introduction about python now let us go for installation part so installation of python is very easy there are two only two things you have to do one is you have to download python and like you set path for java set path here and then if you want you can install python and i think there is something called a slime [Music] also available like sublime so this is another one but this is a actually this is a what this is something like a commercial version which can be used for uh editing and writing your code no i am saying from the easier perspective but in default we rely on python or you can directly use eclipse in eclipse there is a configuration for that where you have to use spy. this like we are installing test ng or other things related to python there is a plugin which you need to install and once you install like you are creating a maven project i can create a python project and python files and you can run so first about installing the python you can search for a general python version so 396 is the latest available so download it so basically it downloads you can just install it so once you installed i'll be getting a folder like this python39 so i just copy up to python39 first copy of the scripts so as usual we go to the environment path environment so this way when you install the python in default we will get the python ide this python idle which will be like our notepad plus plus or anything this is where i said this and sublime will be the same okay so this where you can write your code for example print so just like that you write your python code will get executed over here itself so if not required then only we need pycharm later we will discuss about the pie chart when we are done with the concepts here so first like other things in java you have a class object method similar to that here so the first thing is like suppose here you can directly write it over here in case if you are going to the python so you can download the position here it is a exe file only so it is also provided by the group of intellij people jet frames only you have both professional and community edition you people are using windows only right not mac or windows yeah windows only yeah so you can just download and read the exe where you just install it no need to set anything once installation is done only one thing you have to do over there is once your the spy charm gets opened you have to go to the run edit configuration and here you have to select the python interpreter so that interpreter should be matching with your c drive for example let me do this this way file new project so this is one thing you have to do and here you can see new environment using actually when you have used uh python installation actually that anaconda will be there and pipe pip environment will be there so always with the default virtual environment itself don't go with any other things virtual environment itself is enough for us so that the base interpreter will be the python which we have installed will be used so these are the only things you have to do and then you can create a project so once it is done your project is created this external library is nothing but our reference libraries java eclipse you have reference libraries right this site packages layer our maven dependency and other things we are installing now those things will get installed inside the site package we have fip right so here like maven here we use pip this is where all the tools will get installed selenium or anything you are installing means this is where it will get installed but for installing it here do we require to download and then we have to install right click on your project open in terminal so this will launch the terminal here itself then you can call pip install hyphen capital u selenium just that is enough so this will go check for the latest version of selenium that will automatically get installed over here so it will get installed so similarly any libraries but the important thing is you have to open this terminal here open in terminal the terminal will be launched here itself you have to use the pip which is used for libraries and uh extend extend that is what we call external parts to download and this is where the external libraries get placed and this is where your project libraries and other things so here it will be automatically mapped okay now here if you go this is your project right here also you can create a package like our eclipse which is here python package so this is your package now in default init will be there leave it now you can go to create a python file and create a sample it will create with the py so whatever the code you execute here save this control s tools you can right click here one sample that will get executed that's all everything is similar to wake ups here and there small small changes so that's all about the configuration no more configuration or no very high configuration or anything here everything is straight forward so now we'll start with the basics so first in python as per the content the first thing is about data types so in java you are aware of data types what are data types data types are nothing but to store values to specify to the interpreter saying that what is the type of value it is so based on that they will get accommodating the value right so in the same way only here also so variables are the one which is a container for value and in python there is very basic thing we uh like in vb if you are aware of vb you know that you no need to declare anything on the bbs straight away i can say a equal to 10 and if i print a it will print the value of e so i don't want to say whether a is integer or a is a number on anything in the same way only the python will also work so you don't want to declare what kind of value it is but based on the type of value or the value actual value you provide the data type will be considered here if suppose i say 10.0 then automatically it consider it as a float if i provide it as a string it will consider it as a string data type so basically in python data types are nothing but storing values so comparing to java how does the differences or what is the difference means there is one major difference which we need to know usually in java you are defining int a into b okay a equal to 10 b equal to 20 so say in a equal to 10 into b equal how does the memory will get accommodated here so it will create a variable a here b here and here 10 and 20 correct suppose b value is 10 what will happen so here it will change to 10 correct but in python how does it happen means a equal to 10 so there will be a value created a will also point to the same b will also point to the same it will not create a separate memory the pointer will alone be different so tomorrow when you are creating an another value for b as 30 means then this will be removed and 30 will be created and it will give you id of a id of b so you see the difference here this is the memory where the a 10 is stored and b 10 instead b 20 is true okay now let me store the value of b is also 10 now see the memory will be exactly the same so because they do not create separate separate memory but they will be pointing to that particular object for both a and b so this is how the main difference between java and here and other things are small minor differences only so here the variables have been there we split the variables as uh what we call primitive data types non-primitive data types under the primitive integrals non-integrals under the non-primitive we have strings arrays collections right here the same data types have been segregated into numeric boolean set sequence type dictionary under the numeric we will have integers floats and complex number what is a complex number integer you know integer is nothing but a number with a whole number float is nothing but a point value numbers what is a complex number means a complex number is nothing but a number which is represented together with the real part and the imaginary part okay so what do we mean by real part and imaginary part means for example a equal to 10 plus 20 so this is considered to be both are real numbers so integer instead of that if i say a plus 4 j or 10 plus 4j so 10 is a whole number which is a real number but 4j is not a real number it is imaginary because this value will get updated based on the value of j when j is 0 the whole number will be 0 when j is 12 it may become to 48 this is what we call as a imaginary number so this part is where when these two parts are given together that is what call as complex numbers these are the three numerical ranges available if numeric data types are available and the sequence type so in collections we call it in java where we have a list set these kind of things but here they are differentiating the list and set itself in two different categories so set is independent data type strings list and tuple falls under the sequence type and dictionary that is an another data type dictionary is something which comprises of list and tuple together or list multiple list together in other words if i want to just uh say what is a dictionary it is similar to java maps where you store it in key value for key value pairs yeah so here you are not going to store a key value this is what so now let us get started with the integers first so how do we refer an integer what are the numeric values how can we prove it so first let us provide that so always like in now so since you have worked with the apm and other things you know so in java we use this as a comment single line command and this is a multi-line command here pycharm does not allow that so you have hash that is where it works as a command part here which is like in cucumber vdd on feature files we use this hash as a comment the same only here is applicable so now first we will see how to represent the data type so first for integers so you don't want to declare no declaration is required directly provide any value you want and get it assigned to a value so you don't want to close or you don't want to do anything over here leave it like and then print so this print this should be enclosed with the open parenthesis and closed parenthesis only in case of python 3 if it is in case of python 2 this parenthesis is not required from python 3 this parenthesis is required and see here you can provide a single quotes or double quotes to print okay so it is up to you single double triple anything you can provide over here so a type so to understand what is a now i have given a equal to 5 but does it considered as a as5 means so usually to define any variables in java you put plus sign right but here you don't want to do anything like that so usually you put plus a like that you provide right but here we don't do that like in c you provide comma percentage yes right that also percentage yes you no need you just put a comma and say type of a that is enough so now when you run the code it will provide so a is considered to be a int so the same number if you are storing it as 0 then it will be considered as a float so based on whatever the value it is not i'm not providing anywhere the data type so for example now you can see a is integer b is float suppose how do we represent the complex number which is nothing but two plus four j of c so here we are considering only type so it will print as complex type this is what we call as complex number okay so in default itself the print is going to print everything on a new line only in java we have system.out.print and system.out.println so print will refer to new line whereas uh [Music] what do we call this sorry print will print it on the same line and print ln will print it on the new line but in default here print will be considering new line only so this is how the integers have been defined but do we really need the integers or anything means no declaration do we require means no here you can see so here you can see so missing parentheses only from python 3 the parentheses have been provided so in the id itself you can run the code so here i can say equal to be equal to 5 print type of so here also the same thing will happen so that is where we said either here itself you can use it so now when you we are using by jump so we no need this ide i will close it so these are the numeric ranges we have it in python there are no other things the next thing is about sequence types so what is a sequence here so in general sequence is nothing but line by line on one by one right but here it is going to be like just a quick info guys if you wish to learn testing and make a career in it then we have a good news for you intellipaat provides test architect master course in collaboration with ibm and microsoft the course link of which is given in the description below now let's continue with the session basically sequence in python is something like a ordered collection of similar data types but i cannot be very specific about ordered collection of similar data types i can call it as ordered collection of similar or different data types okay because i remember we we know that in java if you are creating a list that list can be a string integer character if suppose you are not aware what is that concern or what is that list then you go with the object so the meaning is you are again not going to store it in terms of values you are going to consider it as an object mostly whenever we are using this reading excel we always create a two dimensional object or nv store the reason is we don't know the type of records in excel because the excel may have integer dates numbers everything else so i cannot strictly follow string or integer there so we create a object array and we use it but here the most important thing is inside a single set sorry single list itself you can have a number a string and another number so combination different types of that is why i am saying it is ordered collection of similar or different data types so inside the sequence we have strings list and tuple so first about the string so this program is where we are going to discuss about strings what are the strings so basically as i earlier said you can create a string here also again you don't want to declare anything for example i can say so i am providing a single quotes itself so i can print here that is what also starting is to define the scope in java we use this open parenthesis in close processes so this will define the scope of the method similarly for passing an argument we will use this parenthesis so those under to smart the end of the statement you put this cooler these and all is not required here so here you can see i am just providing in a single quotes so there we have a trouble there so if you are providing a single quote it is a character if you are providing a double quote then it is history but here both will be treated as same thing only so here you can see similarly so let's see here even you provide triple quotes or multi codes or suppose you are breaking that into two lines or three lines usually in java we have to use the plus sign right when you are splitting a text you have to put a plus sign or else it will consider it as an error right but here it won't do because it considers the starting and ending point so till that it will consider so you don't want to create like plus here at all so here you can see all our strings only just because i'm changing that into a single quote it does not change to character or it does not change anything everything is a thing same thing okay it's fine okay now you are storing it and you are treating everything as a string but i want a character here how do we represent it so that is where the the alternate approach happens here so inside a string if i want to access a individual character so in java what happens for example i am giving you a string today is wednesday from that i am asking to retry t so in general what we will do so there is a two character array so we have to convert into a character array and put it inside a array and then from that locate right but here you need that you simply call name of one that is enough you see here you know always index starts with 0 so 0 is v i is 1 list what is a list so list are like our arrays only but the only difference is arrays you have integer array string array character array like that but here it is very flexible that you no need of array to determine or to say any specific type of an array it can be of any type so list to determine determine a list you use square brackets anyhow again since i am creating a list i no need to say that it is a list based on the value you store itself they will get no what is it so this way if i provide print so usually in java what will happen if i do this it will be empty right here it will return as none md because it is a empty list so similarly suppose say list equals j so here so now here this is getting overrided here okay so which is in terms of our java what happens so you are rewriting it here so another memory will be created but one thing i have to remember here on python the garbage collection does not happen automatically okay that is one part so we don't want to consider about it because we are using a very less part so python garbage collection will not occur automatically so now you are providing the list so suppose from this you want to create a or you want to retrieve only one value means then as usual you can go and say zero of one so that way it will be able to retry the first landing so you can see i have given which i in single quotes ibs double quotes and this so they will not consider anything they will treat everything as history but instead of test i am going to give 23 so now you can see 23. so this is why initially when i said similar data types i corrected the reason is here it need not to be of same type it is a ordered collection of data that's all the data need not to be of same type they can be of multiple types so this is how the lists are used here and how do we access the list here for example means based on the index only we are accessing the same way as of strings you can use the negative index also here so 23 minus 1 it comes from -1 so traversing the list from the starting and from the reverse order is also possible this is how the lists are treated in python and then the tuple tuples and list mostly they are similar then what is the purpose of having a tuple and how do we differentiate a tuple first of all so the same way how do you create a list the same only you are going to do but to mark it as a tuple instead of square brackets curly brackets has to be used and whatever you are doing the same thing can be done you want to store number you can store it then what does the reason why do we need to have a tuple instead of that so here so what is the purpose of using a list and what is the purpose of using a tuple means now only one thing is like tuples the value cannot be updated for the list you saw the value was updated so now i will say w equals so here this is a reassignment not applying the value suppose instead of 3 i want to put it as 4 so now go to the list under the list i can say list of minus one equals now print just run this so now you can see there was an integer that integer has been replaced with the cell now i go to the tuple print pull off one so here line number nine print double of one tuple object is not callable first problem so in that case you your top pull will not be able to edit at all so this is the first problem or this is the reason why we have list and double so what is the reason then tuple is used means tuple is used where there are some static data you want to keep the meaning of static data is for example throughout the code in a simple way if i want to say in java use the final variable so what do what is the meaning of that final variable it should not be changed it should not be overrided in that way in the same way if you have any set of variables or group of collections similar or different data types which should never get edited or changed or updated then they falls under tuple and the tuples can also be created with the built-in functions also so using like our normal strings also you can provide this so when you are providing this this function is calling so where it is secreting this into a tuple okay you are providing it as a whole string but you are calling the tuple function so now what does the tuple function does segregate into this as a character array like a character array and store it differently you see here so this way also it can be able to perform it and nester tuples are also available the meaning of nested tuples is like i think when you are using i'm not sure when you are using a map you cannot loop it right using the for each loop so what you will do is from the for each loop you will take a single row from the row you will split it up in other way if i want to say i am not sure in the cucumber bdd if you have used a data provider concepts so where it will be sent as a group of characters so let me show that so say test equals zero one two three four five test one now test two 2 is not something new for me it is a combination of the test and test one so say this one comma so where you can see the single test two is consisting of two things this is what we call as nested tuples so in this way you can use it so now in nested tuple if i want to get the value how will i get it so you have to say test one of zero test of zero like that you have to say them individually for example so here one thing here it is throwing error the reason is you are defining it as this you can define the double square this curly braces but when i want to get the value i have to use the square brackets so now you can see here test the same is just one which i same as minus one the same thing you can do it over here so this is about tuples so the difference between list and double list they can be updated yeah here i made a small mistake i wanted to show that i didn't show that here you can see double object does not support item assignment so where you cannot use but here you see list i am doing it where the last value i am updating from 20 to 3 yeah yeah integer has been replaced with the text but here tuple cannot be reassigned that is the most important part that is the only difference between the list and the topic so this is about the tuples so the next is about boolean boolean is straightforward as you know but in java boolean values can be defined in both the ways in lowercase and uppercase right but here boolean cannot be treated in lower cases that is for example print type of this will throw error because they will identify that from the upper case to you now this is what they will identify so this true refers to the positive case and the same way false so they don't consider about the lower cases that will be referred to this is why we call this as a interpreter which you can see if the same issue occurs on our eclipse id means you cannot run the code but here it is allowing me to run the code till the seventh line because the error occurs only on the seventh line after that the execution is failing which is acceptable so this is where the interpreter plays a major role this is how this works so data type with where uh so actually in java we consider it as one bit right either it can be true or false so here in the same way the data type is one of two built-in values we call either it can be true or false but true is referred to true when it is with uppercase 3 and similarly false is falsy when it is uppercase if if it is lowercase they cannot be identified because they will not be defined what it is so that is the only difference between java boolean here so the next one is about set so what is a set so the same concept whatever applicable for java the same thing varies here uh only thing is set like in java no duplicate values accepted and like in a hashtag in java hash it using a hashing mechanism to store so you cannot retrieve it with the index the same is applicable here also but one thing is you can store any kind of data inside the city it is not required that you have to store in terms of numerical values only or string values okay and set is not something directly you can provide because already list you are providing it in that way tuple you are providing with the curved parenthesis then if i want to say a set if i am using some other say like square brackets or a curved brackets means if i use square brackets they fall under the list when i use cover brackets they fall under the top so for defining the set there is a set function inbuilt available so that one has to be used since for creating asset so new python file create set using set built-in function so usually in java how do we create an object for the function and we have to define that whether it is a string or a number like that but here you don't want to do that just to say the name of your variable and then you can say the function that is enough click on debug like list is ordered collection of similar or different data whereas set is a unordered collection of similar or different datas with no duplicates that is the only difference here other things are same and if in case suppose you don't have here like uh what do we call indexes so how are we going to loop it that is the other problem like how do i retry the values based on the index it is not possible so definitely indexing is not possible because it is using the hashing mechanism here also the same mechanism is used so here you can see that one two three which is added the last comes at the beginning and vijay lead qa given that is not in the order so that differs so the way if suppose you want to retry them means actually looping separately we will discuss but for an understanding i will say here i can provide a look like so now the other one so when i'm defining these kind of looping only then to say where my loop starts and where it has to end i can say this call that's double quotes so i can say it starts i and where it has to end it has to end with so you can see here 12 14 18 19 20. so this way okay do you see that so now what is happening it is looping one by one you see here right first i 12 is taken and then 14 is taken so it is like or for each loop but when i provide end means it is going to consider the whole as a single and it is going to order it the last is one about the dictionary dictionary in short it is nothing but like our default map but uh the map defining the map in our uh java is little bit different where you define it as a hash map or a tree map or a link but here again you can define in a simple way that can be so there is no built-in function required for it to define a dictionary list square bracket tuple curved bracket set built-in function to define a dictionary use this parenthesis inside that you can provide anything key as similar to java you cannot have duplicate keys and the keys can be a number numerical or a string no problem similarly values can be different for example one here map dot put you will say here we will say one color you can just put a comma and you can provide it similarly a dictionary can be with the multiple values also actually in your map usually map what we do is you define this way and you say [Music] something but now i want to provide another value for one is it possible here means no right because if i do this what will happen it will override right but here what i can do is i can assign a list again to that for example name and suppose i am giving a designation so here i want to provide multiple designations i can just open a list again qa consultant etc now over here let me make it this dictionary one so now if you run that you can see so where multiple values for a single key can be provided where i am giving a list inside a dictionary so this is how or this is how it is different from our default maps okay we are giving it but how are you going to retrieve that so for example the same way only dictionary one dot designation so when i run that you will get those information over here so get off indexing also will work here so one is not there so which is like one is not there so it is not able to provide it instead of that here without using the get i can just pass this in this way if i do also that will not try so these are the purpose so there is get method which is used for driving either you can use that or just like that you can pass it so these are the different data types available with our python other than this there are nothing available these are the six different data types where in numerical you have integers complex float and sequencing strings list and couple so for any of these things no declaration is required directly assignment you can do go ahead reassignment also is possible when more than one value is stored or when more than one variable is having a similar value or same value they will have the object as also same id will be the same they don't have a different id the difference between list and top list list can be updated tuples cannot be updated the difference between the set and the list is duplicates as usual and the other one is list is an ordered collection set is a unordered collection and dictionary is something similar to our maps but list set tuple dictionary everything they are of different data types need not to be of same data types they can hold a number strings together there is no problem with it dictionary again it is not ditto as java maps there is a advanced option available here where one particular key can have more than one values that can be stored inside a list these are the differences from the perspective of java and python so the next thing is about the loops so as usual we have while loop do i look for loop these kind of things only so we can directly go to that so so basically there are three types of or three ways of executing the loops that can be done so one is like one while using the while loop so where you can use the set of statements and you can define the conditions and you can do it so for example so the syntax will be same the only thing is that parentheses those will be not available here but other things will be the same so first the syntax of while will be like while provide the condition and then the statements that's all the only thing you will do is so usually we say condition open and close parenthesis right but here you don't want to say instead you put a semicolon so for example count equal to zero while count is less than three in [Music] maybe there may be space somewhere i did not notice it okay so this is how you implement your while loop mode here which is similar to java the only thing is in java you don't do this you do this correct so here you don't do this instead you provide this so this way you can provide it so later we will see about when we discuss about the control statements we can say how the control or how the while condition can be printed with that so and one more good part here is okay the while is not at all matching what it will do so in that case also you can provide the else part over here so when the count is automatically three so now you can this else will usually you know right in our java or c c plus plus and all l should be always followed by e for me right but here here also i can provide the else but so if this while condition is not matching then it will execute the else suppose consider the while condition matches so then while will be executed first and then the else part will get executed because already it is done now the count will be four right count is already increased means the count will be four so that cannot be three is not less than three so that condition fails then only it is coming to the response don't consider that a anyhow like uh finally block anyhow else part is not getting executed it is looping three times on the third time the while is getting failed then it comes to the instrument okay so similar to that you can do it suppose uh like uh if if there are so should i always print in this way only line by line like is that line indentation a problem means no actually there is no problem with the line indention the spacing is a constraint but lines are not a problem because if suppose there is one condition which you want to do you can avoid it in this way there is no problem with that you can provide it there but here it will it will go you know that the indefinite reason but i am saying if you want to provide it in a single line also that is possible that is that is about the oil condition now going to the far condition which is similar to our far whatever we discussed just before so the syntax will be like this you don't want to declare anything you can directly provide the iteration variable which is in sequence you can provide and anyway you are going to provide the quotes and then your actual statement you can provide so in the same way you can do this for example a so range is nothing but from when to when i need to execute so i will say the range should be starting from zero till the it will be solved so this way you can do the for loop so this is where usually you will see the ranges right so we will say i less than 10 here you don't want to say you can say range that range can be a minus 1 also it depends on so up to whatever the value you want you can say that and suppose if suppose you are considering that uh instead of this say group i am creating a list say now if i want to implement the for loop i can say for j or for j in group simply i can say that so that all that like a for each loop for all the values it is going to execute because this is also getting executed 0 1 2 yeah but this 4 is not required now so usually in java you provide this right [Music] so if it is there what you will do is you say for string a colon name and then the a will have all the values right the same only i am doing here for j is nothing but my iterator variable so usually we don't do the declaration in python so forget about this so this j instead of the semicolon i'm using in and this name is nothing but my list group and here we don't use the parenthesis so i'm using this semicolon over here this is the simplest way variable and similarly for dictionaries also you can do or suppose other way you can say here say string string equals tester so i want to loop everything means so here i can say for ie and i can say print just a quick info guys if you wish to learn testing and make a career in it then we have a good news for you intellipaat provides test architect master course in collaboration with ibm and microsoft the course link of which is given in the description below now let's continue with the session so this will automatically convert that into a character array and it will loop it that way also you can do suppose i want to loop a dictionary so in that case so d equals so dictionary you can call that and you can say dictionary of abc equals 234 dictionary of df so here i can say that here percentage yes refers to the string and first stage d refers to the dictionary and then percentage i from here cube means it percentage i comma d of y this way you can see so that each value from the dictionary it will loop so this percentage s is nothing but to print the string d this d and i comma d i is nothing but i is the d values because you are storing it nowhere you are converting it as a zero ones tools at all so which is like your map you do for maps right map you cannot implement the for each loop directly so what you will do you will convert into a set and then you will consume it in the same way if i want to hydrate a map here you can do it here and yeah list iteration we already know i in list something like that we do but okay i don't want to hydrate based on the value and all i want to hydrate based on the index means that is also possible here for example take a list and assign a value to that say like which i now i don't want to say usually you can say for i in so this will loop based on that particular one which i want to answer but i don't want to do like this for that instead of that what i can say is for i in range length of list print list of this way again which is like just by getting the index so you do the for loop in your java right for india equal to zero i less than list dot size i plus plus and inside the loop you will say list of i so based on the size is 5 means like that the same thing here you can do that also and the other part is here also you can print the ls block for this also you can provide your else block just i'm printing something so when the far is completely over the last part is not else it's not sorry the far has failed right because then it comes to the else part so while also you can provide the else here also you can provide them else so here also you can provide like our far if nest nested so in the same way here also you can have nested conditions also so nested loop is nothing but like the previous only so here what you can do is for i in range one comma four polar [Music] [Music] so here you can see so oneness i so first one it is this friend is for new line i'm giving rls what it will happen means like a text it will get printed here so only i am doing that instead okay so where nested loop you can do it here similarly suppose for example say for text in this for example say this and here you can say if text is equal to equal which means only in this case continue or else print current alphabet text so what happens t is not at all something here so for text texting today so it will take the if text equal to t means okay or it should be y but a t is not either a or y so this block will be failing so nothing gets executed for texting today is wednesday okay the intention is again and again a problem so when i put the intention here it is taking this portion as a text but this print for me is for the for loop if loop right so that is why it was not printing everything so what it is nothing but in our far string text equal to monday for character to characters array so what will happen that monday will be splitted into character array and from that one by one value will come to a so inside that i am saying if a equals r a is equal to y then so here we have that parenthesis to define it right continue so here it stops but here again i i am not printing actually here i am printing after this so this is so where you can provide multiple so similarly you have break statements also for example instead of saying so this case is getting passed so it is breaking so no more of this continuing value so here the most important thing which we need to know here is while condition also the errors gets placed for condition also the else gets placed similarly that continue break whichever is normal similar to our uh whatever we used over there and one more important thing available in our uh python looping is a statement called pass statement so that past statement is nothing but which is similar to so what is this so i have created a loop that's all but does that does not function that does not require others let's not do anything inside so pass is nothing but an empty control statement or it is used for writing empty loops so which is like you forget about this and now the invention will be a problem move this here so just an empty loop that is so it is actually just moving one by one and it is passing so that is nothing happening over there actually i have never used it in the real time pass alone continue break we are using but i have never used it so i am not sure about the actual purpose of using the pass in one case what i can understand is if suppose at any time i need only the last character i can no need to implement the logic here saying you have to take the last or anything i just write it in the pass and when i provide the text in default it will return me the last one okay so fine list how to implement the list those things we discussed about the continue everything in this question and about the exceptionally so here on the looping itself there are different ways like there we use try catch throws throw here we use a try expect raise these kind of keywords exceptionally we will discuss it separately but here as a part just how how in the looping part how it gets placed let us see so first create a list sample now let me do one thing define a variable called a equals so in if you are using in the apache poi or even normal list string [Music] name equals anything like list dot add something you have one two three so you can either put a for loop or what is the other way you do hydrator right name dot nitrator you say while so in the same way here i'm going to do but you don't want to do the entire thing but here for that we have hydratable this is the function which is default available and then i can pass this sample over here so now here i can say y this is going to be a indefinite loop only while the condition is true try this sample equal to next iteratable object is k and different sample okay this is where we do normal operation now i am expecting a exception here or x a i am x accepting stop titration and if you want you can break it so try yeah now if you see so actually while condition is true while true but this is a static part correct so know where it is going to if this except block is not there it is nowhere going to consider it as a complete operation it is going to iterate indefinitely because while is static true so always it is going to be true there is nothing like a flag i have said to make it as a false or anything else so i am saying try this operation so once it is completed it will accept a stop iteration so that is calling the break inside this loop i am providing this so this is the way which we can use this is not actually a way of handling the exception this is the alternate way how we use the try and accept block so like our uh try catch block or try finally you can remember that so these are the different ways how the loops can be used and how there are three things different from our normal conditions one is using the else wherever required not only after the if wherever required and then is pass which is not at all a empty block of code which is not at all required to implement but as you said somewhere if i need later i am going to write the code or i need the last character then go by that the last one is about this x except x except so where instead of catching it you can do this operation so these are some of the comparatively different from our java the other things are as it is same the only thing is syntax wise little bit changes of course we have the way to handle the exception because in selenium we do handle no element found exception and other things there is raise exception which is like throw exception similar to catch there are keywords available we will discuss that part so the next is about the control statements or conditional statements so as usual we have a file statement only but one thing is here we define it if else if else if those things nested if statements and there are a few things called short and if statements it is nothing different where we are not going to write it in a full form we are going to use elf like that that is where the difference occurs so first let us start with the if condition itself so the first one is if statement so it is nothing but the same syntax whatever you use for our java the same if followed by that condition and only thing is you are not going to use the colon sorry you are not going to use the parenthesis you are going to use the colon here and your statements to execute will be here so this is the way you are going to implement it so here again the problem here will not problem this is how the python is defined so here it is like your statement for example the statement if if is over okay so i'm going to write in another statement means that should fall under the next line so when you continue here then it will become a part of if condition okay so that way you have to be careful other things are the same like our normal if condition will be for example let us see here i equal to 10 i is greater than 15 or 20 plus in equivalent current is less than 15 okay this is over but now if i write it here that falls under the is if so go back to this and write say not inside if so this is how the statement should be written over here so if you see here this condition is false right i is not greater than 15 so it is coming to the next piece of the statement it cannot go inside if because this condition is false suppose it is 100 then you can see that it will go to that and then this condition will execute because this is like nothing but you have a statement 1 statement 2 statement 3 but inside that you have given a if condition if a is greater than b but here the parenthesis define that statement for if so if this condition is true it is going to execute this portion if not as it is going to come here but here that alignment is given based on the line induction only this statement belongs to the if because after the if it comes so this i have to explicitly say it does not belong to the if so the line invention is changing okay so this is a way here the same way only if else also so the statement the same way only here so for example if okay i is less than 200 i is smaller smaller than 200 and i can say and so still in if block so now i have to write the s condition else so this will come under the else print later and print inside now the if else is over now if i want to say anything i have to come out of the loop and i have to say which is not either in if or else so this is the way you have to save over here so here you can see still in f block this statement is executed i is equal to 100 which is less than 200 so it is in the if block and then there is as you know it will never execute and then finally this is the statement which is outside of the if so it is going to execute so when the same if you are using the nested if alone that is also the same way whatever you do in java again the problem is not a problem again the way python assigns or how python identifies that as based on the intention of it so you have to be clear that when i am providing a nested if there will be a lot of problem we will face problem means the line intention problem only because for example now see a condition say i equal to 510 if i is equal to 10 then i will say print is equals okay then now i have to give provide a another nested condition if i is less than 15 then for this i have to write the statement no that if i can if i write it here then it will fall under that particular if so again i have to go here and i have to write here print i is less than 15 okay this is over now again another if condition i want to write so again come back if i is less than 12 or 30 then again a print statement print is less for 12 less than 12 okay now i am going to write ielts but this is where you have to be careful so i am writing else here so now this else will be suitable for which one this part so if i want to write a is else for 12 okay now i am going to write an another is here then that will be for else for 10 so this condition so this is how it works so see here so e is equals is true and then i is less than 15 and is less than 12 so the cycle goes on like this this is the way you have to write that there won't be any problem suppose you wrote this way then this else become useless useless means because already you have given a condition else but this these two if does not have any else but okay so this is a way you will go on so this is what we call us so this is about the nested if so the next one is about the if uh if else if so until now we have discussed it files nester differently the next one is about elsif so usually there one difference here is you we do it as is if right but here we are going to do it as elf that is the only difference other things the same as line indention and the other remains the same and when you are providing the last part it should be is which is similar the only thing is you are not using the full-fledged else if else like that instead you are going with this approach so these are some of the operations we do it and finally shortened operators shorted operators that is shortened if statement means just putting it in a single line the shorthand conditions are used is there are only one single statement needs to be executed when the condition is true or when the condition is false then we go with that for example i equal to 10 to if i is less than 15 or 16 yes so this way you see so this is like our binary operators you use right in a single line you will see a equal to 10 and c c equal to a so these are about the looping and the last part is about the stream part so here in this part we have string operators also available so mainly here for you it is called a string concatenation operator so for today's session that is the last thing concatenation of these operators so string is nothing but a collection of unicode characters why do we call that you know that because in java also the same thing right because inside a screen you can provide a number also but it will be treating it as a collection of characters only right the same way only here so first one is about the plus operator so the plus operator is nothing but a concatenation operator which is used for merging two strings basically strings are immutable we say so you know the difference between mutable and immortal right so whenever it is concatenated or whenever we do concatenation it is required that it can be assigned to a new variable so for example let us see here so now i need a third variable to concatenate string a string so where i can separate string three so this is the first operator which is called as concatenation operator instead of that you can see join also so the join method is the one which is used for not directly merging the join method will return a string in which the elements can be or the elements in sequence can be joined it will be able to do that for example the same thing you just say string 4 equals join so here i can say string one comma string screen [Music] so where the same thing it will do but what does this join operator string the string whose method is called is inserted in between each given string the result is returned as a new string so to save that i'm using so when i say join so it is using that particular part so instead of using the plus directly you can use the joins also and similarly the mod operator usually we use for division to get the remainder right mod operator using that also we can do formatting of the string it is not used specifically for concatenating it is used for formatting which can be used for string concatenation so formatting can be used for string concatenation the meaning of that is percentage is nothing but which is used for concatenation but to the whole apart from concatenation i need a well formatted string then we go for this particular percentage which is nothing but string 5 equals percentage yes so now if you see here the formatting is having a space so that space will be falling under there so the formation like in date formatter you provide right when you provide y mmdd means based on that it will provide the same way this is used instead of that you can use the format function also there is a function called a format which can be used the last one is about the format instead of this this and all it is not possible in case if you feel that then you can go with the method there is a string method itself available here in the site packages here it does not show like in eclipse we can see the classes and methods right somewhere we can see that info also i'm not sure in pycharm or another okay i will find out during the selenium sessions so here i can say print double quotes dot format string one comma string so this will be able to stream and provide that info so this is your formatting way string one this is this part this is string one this is string two in between the space or like you said put a comma over there that should be there so instead of using this percentage you are using the format so here there are not much things available like that very complex things are not we know now how what is a variable so basically there are global variables and local variables under the global variables static variables are there but does the static variables needs to be defined with the static keyword means now in python now whatever you are doing inside a class and default they are going to be static so how to create a class for a python so those things we have to discuss you will move on so i find that on the data types one part i left which is a raised part so this arrays which is similar to list but one problem with the arrays is arrays cannot be a combination of different data types that is the only difference in the arrays similar to list only but arrays are the one where you can store values of same data types so let's see how to create an arrays and then we will want the next so creating an array like a list you are going to create but while creating an array here we have to be very specific like what is the type of array i am going to create so here the arrays can be created with the help of say variable equals array so to define that as an array i have to specify this followed by that i have to say that what type of array it is i so basically so for rs you have to specify the type of data type so that data type how do you specify in that sense means basically for our uh this we do it right when we are defining the array list we say string arraylist name of list equals new arraylist of string so here the string can be a string or integer the same way here if i want to specify i n uh u and f so i is for numerical values integers that can be even negative l is for long and u which is for characters unicode characters and f is for float this is what we need to specify over there so that is what the first thing we are doing we are providing it as i told that for that i am going to store integers comma then as usual you are going to create a list and you can provide your numbers but for rs alone you can see here it is throwing here what is that undersold reference array why because for list and all this is directly available and we are not using any methods we are just using it as a variable name this list is nothing but my variable name and i am giving the square brackets directly so they assume that it is a value so it is a group of values but in case of arrays this is the method actually so which is available in array so you want to do the input then only this array will be recognized so from array import array so you can provide a array alone if you want you can keep it like this in general we usually go with this star as we know right in eclipse we do it so import rg dot selenium dot star so that all the selenium libraries under the words you open q a selenium will fall under right so that is the reason so this is how the arrays get stored so here i cannot give a combination like list like so here if i want to look for i in variable the print i so this will provide me the list of sorry group of arrays one by one so this is how the values get stored and for retrival you can use the index as well so you can get it based on that so what is the purpose of using this arrays in that sense means where it has certain methods available so for example now you can see that dot so pop pop is nothing but which is used for just a quick info guys if you wish to learn testing and make a career in it then we have a good news for you intellipaat provides test architect master course in collaboration with ibm and microsoft the course link of which is given in the description below now let's continue with the session removing the topmost one similarly suppose i want to reverse then i can call the reverse method which is used for reversing and it will get stored inside the variable in itself that is my defined array itself will get reversed so now when i print the array so you can see here it gets automatically reversed so these methods are in default available with the so here similarly suppose uh i want to create an another array so i want to but i'm not sure what is the data type i want to provide or in other sense i want to create an another for example variable one but i'm not sure what can be the data type or how the data type should be provided like that so in that case what i can do is i can say variable dot type code so this will get the variable uh like from the previous array it will take it and then i can say here a for a in variable so the meaning of a for a in variable is like we do right so this is one set of array this is one new array i am creating so a for a means zero position one position two position three position for example so similarly it will create zero one two three and it does like a for a means copy zero position and put it in the zero position copy one position and put it in the one position not like a hole it is like one by one operation so like that it will do it so this is what actually we do in terms of suppose i'm not specifically want any array i want to use some array of same data type another or same data means then we go by that way so now if you see i will remove this so see here which is like a copy just a copy so where i am not inserting any values or anything but i am following the previous array this is how we can just create an array and look at other operations like list you can do any kind of operations over here only thing is we have to call a method similarly for list dictionary don't we have methods means yes we have methods because from the high level only as a data type we have gone through those things but like our list is having a method like get method uh remove method these kind of things right similarly here also we have a set of methods for list dictionaries tuples and all those things we will see so now the other cases suppose consider a case that you remember in uh in java you do have a scanner class right in the same way here also if you want you can get the input from the user for example here i'm going to create an integer array comma and leave it with the empty square brackets now i am thinking of to get the input from the user so now say length equals so here in order to get the input it is very straightforward where i want to get the integer as an input so i say integer followed by that say input so which is to get the input so what is the message you want to give to the user provide that enter the length of the array you need to create so this way it will ask from the user what is the length and then based on that you implement a far condition for i in range length so up to the length it will loop one by one so now you go on here create another variable called x and get the list of values here you have got only the length next thing is you want to get the values so say input enter the next values and now you are getting the value fine after getting the value what you need to do you want to add it to the array here right so how do we do that here so that is where under the array we have an another function called append so append that to x that is this is the value you are getting and storing it in the temporary variable or just not temporary actual variable x that you are copying it here appending means adding already it is empty so now when the first variable is added say i am giving one means one will be added two will be added like that it keep on adds so this is how you can simply add an array so now [Music] fine so now you can see there is construct an array and it will drop it yes so what is the type of value you want to accept from the user so there you call it a scanning so you could say scan next line next integer so here you have to see what is that i want to get from the user that is what this is a class which is used for getting the input read a string from a standard input the trailing new line is stripped off so this will be in default reading it but now when it is reading it as a stream you are reading it as a data but now what is that you want to do here you want to consider it as a default input this is a method remember like it is a method like a scanner class but in a scanner class you are going to give next line next integer everything but here the input class is going to default read it as a string okay so now okay forget about this part now go here [Music] one so this is how it works because i no need the conversion to be happening here because you fold it reads it as a string only as you know suppose you are doing some values here and you are appending fine now suppose you want to do a check like whether the array is having the value which is i am expected means then you can see search value search when you equals input enter the number to check for so now here you are going to say that i equal to 0 for i [Music] [Music] okay so this is nothing but where we are trying to identify whether the value is available or not for example so say 3 1 2 3 so now what is the number i want to check say 2 means so this will be verified and it will return the position of so enter the position so that will be retried over here so which value i am searching for whether it is there or not so that is what searching a value inside a so which is nothing but in default we are declaring is0 so i invert so which is like this variable so it will look throughout the array so for ie starting from 0 to 3 so first value it is assigning to search value so 0 search volume print of i so it is trying to print it so now if it is the expected value no so it will loop on to the next then it is the expected value the condition passes to equal to two then the breaking happens over there these fine no problem directly everything is inbuilt fine when i want to go with two dimensional arrays and other things that is where the problem occurs there the support will not be available here it may require some other libraries but that libraries are not available in default doing install that what we can do is you can go to the [Music] so here you will see all your libraries whatever is required right so here install search for something called numpy so this is a fundamental package for array computing within python so this one you can install so i'll install this package which is nothing but this allows you to treat array as list so you don't want to say that explicitly that i am going to create an integer or i am going to create a string or a character unique or nothing based on the value you enter itself they will identify and perform the operations so for example it is done that's all like in our eclipse marketplaces they know the same way this is here it is so in future also if we need any other libraries we go here and we can install it so why we are doing this means it is straightforward where like list here itself we can do the things you don't want to specifically say anything here in here but any array library has to be [Music] that is the advantage of going like this but there are two different purpose of using this numpy either you don't want to give this the alternate is variable one equals array off you can give one to three followed by that just map it to integer so these are the two purpose why we have to provide it in this way but this is giving here maybe i will look into this and i will check why it is happening any specific okay but what is the most important thing why we required an uh numpy over here means it is going to provide me some set of functions which will be very useful for me for example say variable equals like uh line slavery line space are here these are something which are like of default functions available for example uh say that you want to create starting from 0 up to 10 i want to create an array with intervals of 2 so now i won't print this where what is that it will do means the range is between 0 and 10 are 0 and 2. so that will be splitted into two offs so now you can see so between the value 0 to 16 that has to be segregated with the portion of 0 to 10 as like that it has to split up to 16. so 0 to 10 that is 1 1 to 10 is 3 like that it will split it into equal offs so that is line space so here you can see so the purpose of lines returns evenly spaced numbers over a specified interval so the purpose is to but i don't know actually where it is used i have not used it because in selenium we don't do that we retrieve or we do some option but actually what is the purpose of it i don't know but there is no there are four four different methods provided by this number so those are in that one has written evenly spaced numbers over a specified interval i think maybe you use for boundary values or something i am not sure about it so that way one method similarly a range is there so this says about say like 1 to 15 so this is like setting a range so return evenly spaced value with a given interval values are generated within the off open interval so the first one 1 to 15 start and stop the interval is between 2 so now if you see here so 1 2 1 3 that is the next interval right so 1 3 after 3 4 and 5 5 like that up to 15 it will go on the interval is 2 1 2 4 5 like that you understand that if the same i provide as 3 means there is one thing and similarly we have something called a lock space all these are numpy core function i don't know where actually it is used but there are few things available so this is like suppose you are providing like this so which means it is going to take that as this way so 1 so at the interval of 40 it will be printing it up to 5 extents one two three rotation but if you are unable to read it you can parameter this uh we can format it so the format is it is giving a float value so say percentage to float the meaning is two digits and then percentage where of first value our second value of third value you can draw it so you will get the exact value of it so up to so these are some of the things available okay but what are the importance or why do we go for numpy what is the advantage here so any of these are not used but using the existing array itself the other operations can be done means logically some of the things can be made very easier here like copying an array or adding an array are mathematical calculations like uh calculating the minimum or fetching the maximum of an array you don't want to write logics for them they are openly directly available for example say variable equals array of now i want to add a value for all my arrays means i can simply say variable equal to variable plus 2 so now all the values will be added by i don't want to write any logic by fetching for writing a for loop fetching and then add every number plus 2 i don't want to directly i can do similarly suppose consider a situation like there are two arrays then i will be able to add just like variable equals variable plus where you can try variable so directly you can add it nine plus one ten eight plus two ten seven plus three ten six plus four ten five plus fifteen so that way it will be directly you can look but in case of if suppose the numpy is not available in a general array also you can do but in java you write the logic right so you have to create a temporary array one by one you have to take and then you have to add it and put it in the temporary array and once everything is over then you have to assign the temporary array to the any array the same way only you have to do you have to create a logic over there but here you don't require similarly for example print minimum of variable so directly you can just get the minimum value here so the minimum of our variable array is one so similarly maximum means it should be five so those things can be directly retrieved you don't want to do anything suppose uh okay i don't want to add and all but merging these two array i want to create a new array means then you can use a concatenate function where you can say variable comma variable one so this will concatenate and form an entire array here okay they cannot get ordered because that is the way you are adding it so after this 98765 will be done so they won't get ordered themselves at all because we are not doing anything internal so that is the purpose why we are using it and here one thing uh specifically you want to say so there are two types of copy they are calling it so the previous array i told you about how to copy an array right just by using that uh type code you are just copying it so that that way of copying is considered to be shallow copy where you are just copying the value as it is no i don't want to copy the value as it is what is the purpose or what will happen when you are doing the copy like that means your array will be created here now you are saying shallow copy means array a is there means it will be pointing to it now you are creating an another thing b means that will also point to that that's all that is what we mean by shallow copy but deep copy is something where i am trying to create a new object itself new memory itself for that so how do we do that in that sense means so see here so it is what we mean by shallow copy so actually it is not creating or anything else it is just assigning it instead of that if i say a dot b there is a function called b so if i do this now you can see here the memory will be varying so this is what we mean by shallow copy and deep copy this way is considered that what i am trying to say is i want a value similar to this that is what i am trying to say so this will not point to a reference instead it will create it so that is why even though values are same here you can see the memory object is different so these are some of the arrays and array functions we can do and there are still more we can we are having when you have time just go through it what are the functions what are the uses of them everything you can get it so so yeah this one finally so now you are storing an array right but you want to know what is the type of an array means then you can say d type here so where you will get to know what is the type of the array here so see here integer 32 now suppose consider that this value i am putting with 5.0 now automatically it will be turning into float because you have given a point value here right so the entire array will be treated as float so till now whatever we wrote as like in java we straight away write everything inside the main method we created everything directly now the next thing is how to use functions so we will discuss more about the functions in the python classes and objects but here only one thing for one reason we need to check a slide how we pass data how we can pass data with the keywords in order to define that we are going to do that so similar to our vb only here we will be specifying the functions the function should start with the keyword definition define and then name of the function you can draw it and as usual arguments you can promote and then you can write anything here and the data type will not vary for example there we used if avoid in terms of returning but here a method cannot here itself also i can do the returns that are all we will discuss in the class but here what is the purpose we are going to discuss it is for example here i am going to create a method this one so now name of the function and this method is asking for name so then i can pass the name here [Music] single so this way you can pass but now you are passing here so i can get the name and print it over here so now run this code so position takes one positional argument but four were given right which is you know what is the reason but what reason i want was supposed to say here is in java it is mandatory that you have not only in java even in vb or in c it is mandatory that you want to call a method you have to pass the number of arguments but here it will be a little bit different where i can say here saying that hey i am not very sure about what is the set of data you are going to pass next so i can provide just something like star data so it will assume that anything comes after that let it go under the data name is the first one so let me take that the other thing whatever you pass let it fall under the data so everything will be grouped under the data and it will go there okay so this is what actually how the data this data is not uh something like uh any keyword or anything it is like my value just like a regular expression you use right so it is just to say that i am sure about this value it is a name but i am not sure about what are these things so i am putting this so in other way suppose consider so where does this passing the keywords come means okay you passed this it is equal to name fine but what is this what is this what is this the question analysis right to overcome that what i can do is i can pass with the keyword this is age this is place of or origin or dissemination not designated place and this is mobile number like that but when i do this they will not be able to get that information here got an unexpected keyword argument h so to make that to recognize here add an another asterisk so now if you run it it will identify and it will store as a key value so now if i want to fetch the data from there for example okay it is done but uh from my value i want to retry the values means then it is easy that you go for so it will print all the items inside that one by one ages 28 designated mobile number so you can j is the actual value i is the keyword so wherever you want only the value use j and omit the ipad so that you will be able to access only the value and here one part good part are uh one thing is like you know in java you may have a main method and you may have an another method like add and together you may have a class and say you are declaring a variable a equal to 10 now go inside add method so this is like when you are declaring here it becomes a global variable right global variable a now can i go here and create a local variable a means it will say as a duplicate variable right but here it will not do that you can see here a equal to 100. now i come [Music] so now this will not throw any kind of error see here 5 because the scope is within the method so within the method the variable is a it is holding the value of 5 so here it is 100 so don't consider it as reassignment or anything this is inside the scope this is the value of here and outside this one this is the value this is the way it will be accessed so this is one other part how the variables are treated inside the method and similarly to those you know like uh if i want to pass any kind of value for example now we have passed a number strings suppose you want to pass a list also means you can pass a list for example you can pass directly here into the list itself you can pass suppose you want to do suppose for example let us do a small workout here say that i want to verify whether the given list in that what is a even number or odd number like that means then you can see here even number equals but when i'm returning it as a even comma odd then here it should be yeah here it should be a color and here it should be this one yeah so now here i can see even [Music] so now this will get passed over there and it will verify the number so now let's print it so here you can see so one by one it goes on like that so this way also you can pass so here we need to know that we can pass a list also over here so these are some of the inbuilt options and these are some of the things which we have with that number as well and the other important thing is it need not be a fun method or function but here everything is similar you don't have any difference here right you have a void and you have a return type into because it is not going to consider it as what what what what it is but is it possible means very very random case for here i am checking for a number whether it is a even or not in your case if you are checking for something related to a number understand yes you can do it these are about basic things so now let us go to the okay so the next thing is about python classes so the class in python are which is similar to our java classes only so class is where it is a blueprint or a prototype where inside which you are going to create object or you are going to create a constructor everything is same the only thing is how do we create a class do we have a concept of primary class here how do we create an instance of the class so those things alone so basically here we don't have any specific uh that to define a class we use the keyword class and inside the class whatever you define that is a variable whatever you use in default they are class variables in other terms they are static variables you don't want to explicitly say it as a static keyword or not inside the class whatever you provide in default they fall under the static category because they are belonging to the class and inside the method whatever variables you are using they are considered to be a local variables either the class variables can be considered as a global or static variables let's see how we can create just a quick info guys if you wish to learn testing and make a career in it then we have a good news for you intellipaat provides test architect master course in collaboration with ibm and microsoft the course link of which is given in the description below now let's continue with the session so first to define a class class followed by that name of class that's it so then you can pass any kind of statements over there so this is how it goes or get so say so i said no that pass which we used under the break and all just i don't have any any statements to write for syntax ways so i just make a pass over here it is a null operation when it is executed nothing happens but if i don't provide this the class will be throwing an error state right so to avoid that i can just put it a pass so that the class is fully completed so from that perspective i am saying okay so this is a simple way you create a class over here so objects object you know something which is having a state and a behavior is considered to be an object an object in otherwise it which is called as an instance of a class that is fine so here how do we declare an object and how do we instantiate in java we know we use the new keyword and using that we will be doing it right but here how are we going to define a class or where we are going to create an object it is straightforward for example say create class then you can provide any of your say what is the attribute of it so provide attributes attributes attribute is nothing but variables i am going to provide a variable so attribute 1 it is a mammoth attribute 2 which is a dot now let us create a method here or a function define function self so here this self this self is a keyword which is used to refer the current class okay so you create an object and you point it right instead of that i can do this so now i can say print dog is yeah self dot attribute of what now the most important thing is how to create an object create object and instantiate it so usually in java we do using the name of class or name of reference variable equals new keyword followed by the constructor name right so here you don't want to do like that but this portion is required so where you are going to provide the reference variable equals on the name of the class no keyword or anything just call the name of that that's all object sentence initiation is done so now you see print about the call function how do i call that reference variable dot function so i don't want any keyword or anything but internally the constructor is there we will discuss about the constructor here just a name to make it because when you are trying to use a variable here then it will assume that what is that variable whether it is a local variable or a global variable because here you see global variable is also a local variable is also a so within this scope only the local variable will be used so when you are directly providing a it can assume that you are calling the local variable that is the reason why explicitly we are saying that hey i am not you about so in this case suppose you provide attribute so it is undefined here right and here one thing the class methods we are having now the class methods like functions my function whatever we have they will always have an additional or an extra parameter inside the method definitions so either you are giving a value for that parameter or not in default python will provide it so to define that if suppose consider a method that does not have any argument but still we have to provide one argument over there you understand what i am saying so there is a method you are creating but there is no need for the argument to be passed because i am not using any of the argument even in that case python internally will provide an variable there python will provide a parameter inside the function inside a method in default to work on that situation i have to pass an argument you may not be using it but internally i have to pass an argument there for example i will say here state clause so here you can see person takes no argument where is that last person this is the constructor we are creating the space was a problem again so first of all here in default in java how do we create a constructor based on the class name then it should be named this way so here in order to create a constructor it is not actually a constructor this is something similar to constructor sorry that is in java this is a constructor here this is how we create a constructor we don't provide the class name or anything init is something which is defined for creating a constructor where which is used for purpose of initializing the object state so like uh other you know the purpose of constructor we have argumented constructor and parameterized constructor here constructor is also where you can write the set of statements collection of statements everything as in java here also so that is what here you have done so you have created a constructor for the class person and that is having asking for one argument you are providing it that is what you are doing here and that way you are assigning a variable and keeping it as self so self.name means then it falls under the class variable so that is what we are calling here so now when i printed my name is it is coming so that is mandatory here to underscore underscore we are probably now that is how we pass a constructor over here it is mandatory that we have to pass the same so now we discuss about the instance variables and classes how instance variables are used what is an instance variable so instance variable or nothing but in java the same things only instance variables are data purposes where that value so here instance variables for them the values will get assigned inside a constructor or inside a method they will not be done within the class the declaration will be done earlier or here we no need declaration in java what is an instance variable you declare a variable and wherever you want you implement it right you assign it so here we don't have a part of declaration right so here how does the instance variables are treated mean instance variables are treated in a way where a variable which is used inside a method or a constructor then it is considered to be the instance variable for example say class so now first one is class level variable okay now create a constructor so either you call it as a create constructor or you call it as init method define underscore underscore unit of self and now if you want to leave it fine this is a normal now i want to have some more variables then pass it read and color so where you can create instance variable instance variable what do we mean by instance variable here grade this is a new variable which i am creating read this should be similarly 7 dot color equals color okay so where you are initializing two instance variables here and then if you want you can create a so variable is over so now let us create object or class so how do we create an object say d equals okay now can we do this in java when it is already constructed then already you have parameters sorry when you already overrided the constructor the meaning is you cannot do this right so what you have to do you have to pass on this additional parameters over there so you have to do the same thing here so see here from sample dot class demo import talk so we are importing it and it is done now whatever you want you can use it so now this because dog takes no arguments why yeah comma about yeah it is referring to that sign okay this is correct [Music] actually single quotes and double quotes should not make difference i'm just checking [Music] [Music] now the constraint here is product object for yes say yes dot read color so if you see here see here the same way only i gave maybe some space constraint or anything i don't know okay no problem so here the thing is like this variable is considered to be a class variable where this portion of variable is considered to be a instance variable so that is the takeaway here so the class variable and the other thing is like the reason you remember right i told that whatever you are defining inside the class in default even though you are not providing it as a static they become static so here the class variables can be called using that itself class name itself dog is the class name right leave the object so if you want to call the class variables using the class name itself you can call if you want the instance variable to be called you can use the objects so then the next thing is like how to use the instance variable inside a normal method so now we have used inside a constructor actually defining instance variables inside method global sorry class variable and create constructor so this will be now instance variable which is named instance variable called name now let us create different methods so now we have created a constructor now create other methods so let me create a define set color color another method so here what we can do is we are driving the instance variable so how do we retry the instance variable so using self dot color let me make this as a getter setter method so [Music] so here you can see so what actually what are the thing we are doing is here is where the actual retrieving the instance variable inside a method this is that what we are doing here here with color so we are able to get the color over here so this is how it works so these are about the classes methods constructors global variable or class variable or local variable you no need unless if you are sure that i will not be calling any of the global variables and other things you remember right here so here and all you remember right we never use that the reason is we don't have any class level variable class itself we did not have so no problem with that okay for example let us create class sample here you see here a function is an executable statement it executes the current so here it started see even is not recognizing so now there is no other way i have to give that if you are not specifying this here then no problem but you are specifying it here actually there is another case also here you have to remove it if you remember the first what i said so in default when you are creating a self method whether you create or not in default an argument is there so you may not be using that argument or you may not pass that that is what the self is like in java you are saying no whether you create or not default constructor will be there you may not perform the operation anything that is the reason you are getting always empty but if you overwrite the default constructor without passing any argument but just you are printing something here then whenever you call it you are going to use that right usually this constructor we don't create what is the reason anyhow we are not doing any operation here so even though we are not creating in default it will be created so both are same we are not doing but explicitly if i want to type something inside the constructor we create it even though it is not a parameterized constructor right so in this case what happen whenever i call name the i will be printed and then the arguments we don't have any arguments but the consecutive operations will be happening right the same way what we hear the cell that is what is the second point itself we are considering that self okay we understand that it is related to the current class like you said current class reference but in other way when we are discussing about the init method what they are clearly saying is the class method must have an extra first parameter they are not just saying extra parameter they are saying extra first parameter that is what the self parameters in the that should be available in any method definition itself for that you don't want to give a value so nowhere we are giving value for self right so just discuss about the details on the variables and we will move to the next part so as i earlier said you don't want to see any static so just you can see a list of variables and we will move on to the next thing so like i'm saying so we are going to take a class say about the student class so here first let us define a global or class variable so it is not required that a class variable should be defined as static here and there is no such keyword but in default the behavior will be like a static variable only so say there are mine or group so say there are biology students or something now let us create a constructor so which is a init method defined in it so let us add another variable to them saying that roll number self dot roll number rule number self.name so these two are considered to be instance variable because they are defined inside the class now creating an object so say a equal to student and you can call 23 and let us provide an another information like be equal to student 24 right so now let us do the print statements so a dot group b dot group a dot name we don't name similarly and also to know that should we always use an object or self means no it is that we can call the so class variables like in our mostly in page object model or in any of the framework we use static drivers so wherever we need we will get the driver using a static block right in the same way here using the class name itself you can call the particular class variables for that it need not hold a class variable or anything else or any keyword like static or anything else similarly suppose say i want to update the group computer science then print a dot now if you see here so here c so till now this is a local variable this is a global variable this is a instance variable so for instance variable we are setting it based on that the values are getting retrieved populated so biology biology fine vijay shalom everything has to trade and this is where we are driving based on the class name student.group so it is retriving and using the class name itself we are doing a reassignment but reassignment is also successful and because of that when i retrieve a dot group it is able to update it so this is how it works here so this is how the variables and the local variables class variables all these things will be playing a role here and one thing here i want to do yeah everything is fine already we have discussed those so this is about the variables part and lastly about the scope of the variables so one part where we need to know is here so this here you can see here for example let me create a string session okay this is the stream so now i'm going to create a method called the function and i will be using an another variable here called the string yes this again session now here i will go and say function of a print string so now if you see here what is expected is first this one because you make a call here and inside that that string will be printed and when comes out of that as expected this trick because the scope of the string is outside the method not inside the method outside the method so when it goes inside the method the scope is this string so it is taking that information over there so this is one thing and there are some problem where we will face for example you have it here forget about that you have not defined a string here like in java will it take the default string here means basically it is not going to take that it is going to throw an error saying that oh it is taking this maybe the declaration what i have done earlier so now if you see here current string yeah now you can see here not not required so see here i have a string on the class level but it is not inside the scope of the method but the method is having another string here but that will be executed after this only so in this case for example now it will define some so suppose you have the print statement earlier then it is going to be considering as local variable referenced before because you may think that this this is a global stream so this this assignment is happening and then only i am doing a function call right so this might be passed here that is what my expectation that is how in java it will work correct but here it will not be in that perspective these are the small differences over here and that's all the other things are seen so there are no more things here about the variables erased now we can move on to the object oriented concepts first about the polymorphism polymorphism as similar only the only thing is like here we don't want like the arguments to be explicitly so because earlier if you remember in java polymorphism are done by two compile time and runtime in compile time we do method overloading in order to do method overloading one important concept is way we provide that will be able to handle that so for example can i provide add x y x y means it is going to be duplicate only right but how can we differentiate it so that is what we are going to see now so first let us go one by one so the concept of polymorphism the same java the same way so where same function name method signatures but our signature is going to be different and it can be used for different types as well so there are imbue to polymorphism first available for example uh inbuilt polymorphism means that that is uh already there is a method available like in our string classes and all we have in java right character there is not character sub string of so in substring itself there are two methods you will have one oneness where you can provide only the starting index and it means i can say name dot substring of 0 comma 2 so which is about this one another one is name dot substring of 2 so which is i just provide the beginning only till the end it will take so if you consider these two are actually the input of polymer for some is implemented right because they have the same method name the number of arguments differ so similarly in python what is the inbuilt polymorphism method available if you want to see ah the same string function itself for example let us take like a print length of the string so if we do this this is where it is calculating the length similarly there is an another method which is there where i can provide the list so one is character one is a group of text another one is a list so where in default they have that method has been over overloaded with a different set of arguments and it is used for example now in our case how are we going to do it for example simple thing i want to implement the add method x comma y if i provide this so where i can use two arguments but if i want to use the third argument also then i may create an another so in to avoid that what we are going to do explicitly here which is not possible in java where i can declare a variable and assign it to 0 in default so what will happen means x plus y plus is it now from your perspective you are calling add method if you provide 10 comma 20 in default z will be taken as 0 so you will be getting the result only for 10 plus 20 30 right if suppose i want to provide a third variable then i will say add 10 comma 20 comma 30. now this will overwrite the he said assignment and i will be getting the result 60. this is an alternate way where you don't want to create multiple methods at alone so in a single method itself where you can override it this way so this overriding is happening in the call so similarly polymorphism can be done with the like uh the init methods we use right in the same way also that can be done for example say this is method overloading so let us create a class so this is one class now the same let me copy and provide it over here and let me provide it with the different i don't so now here so there are two classes one class is having these particular methods under similarly so actually this is considered to be two different classes right so now what we can do here is say india equals new so now what we are going to do is based on the condition for country in india [Music] amd poland so here you can see for both the things it is retrieving so where this is like just a quick info guys if you wish to learn testing and make a career in it then we have a good news for you intellipaat provides test architect master course in collaboration with ibm and microsoft the course link of which is given in the description below now let's continue with the session so here what is that we are trying to understand here okay it may look like okay if suppose you consider this situation as a two individual classes then they do not have any relation but what is that we need to understand from here is these classes without being concerned of what type they are they are able to loop it so this is because of the polymorphism which is inbuilt so there they are not concerned about what is the type of the capital or what is the other language what is for india what is the capital or what is the type for america what is the type nothing it look for but in general it is able to loop it throughout the country so that is where the polymorphism is actually existing in this class that is the reason we are doing with this so these are about the polymorphism point with the direct and now about polymorphism can be integrated so actually polymorphism is one where now i want to do inheritance along with the polymer sorry polymorphism with inheritance along with inheritance so which is we call literally as overrating right because in order to achieve the overrating first you have to do the inheritance yes so say class so first of all here we need to know how do we do that extends there we use extent so what is the method we use here so see here now consider another class called animal so we don't use any keywords and all just put it in a bracket save our that is enough so that way inheritance works here so now i call it define flight self so where you are already inheriting so when you are inheriting the default properties comes over here but still you are trying to override so now here you prefer some other method define inside line method okay fine so now create an object and try to access it bird equals bird off so word dot inside reptile class now let us see how it happens so see here so here this is where the first overriding happens so inside animal class flight method it is going on so where you the overrated is called similarly here inside reptile class flight method goes on and this is intro we have not overrided so it is well ended so this is how it happens here so you don't use any extends keyword just put it in the bracket and as usual the same thing you are going to create a class only thing is you are not using the annotations over right here other thing concept wise the same thing similarly the polymorphism can be also implemented with the functions also just like with the returns and other things so let us yeah so here about the polymorphism fine so now let us go to the inheritance here we have multi-level inheritance multiple inheritance everything is there let's see so the first one is inheritance in default we saw how does the inheritance happens over here now let us see here let us create let us create a and let class have a constructor just a regular method only i'm creating all as i earlier said it should be in uppercase always so this is one thing so now another class we are creating where employee is extending the class called a person so now here let us write this define employee and it should repent now go here employee equals person and it is asking the name to provide a name and now print employee dot get name is employee so here we have created a class called a person it is having a constructor and it has three method so here yeah so here we are assigning the name and here we are just returning the name and here okay and similarly here now here i am creating a reference for the person and passing it so that this will be called and it will be passed so now the employee dot get name should return me the user called i and it should return the value called true that is what i expect but because the false has been overrided here into two so that is what i expect let us see what is happening so that is what so here this is from the perspective of the first class it should be this one so now go to the second class now all the same method so here the expectation is around so this is a normal one which we do so this part is fine so similar to that we can do one thing so here the first about the general inheritance this is the way so now the next thing is about subclassing there is a concept called subclassing here which is in general when we discuss inheritance in our java in default when we extend we are making a subclass only but here the concept of subclasses the child class needs to identify which class its parent class by doing that it will be able to get the information of their super class for example the same method you take so for the class person itself if required you can pass an object so what do we mean by object class in that sense means in python the class test and the class objects are one on the same so what is the purpose we need to create a class with the object as parent means it is used for the purpose of creating the root of all classes in order to generate root for all classes which is nothing but here we are defining a person right so here i can say [Music] this way which is in default you are just literally creating an object for a class so whether it is required in which way it is going to help you so in that case it is nothing but it is you it is used in order to mention that the class person is an ancestor of all class that's all there is no other specific reason for that to highlight that that is the very first class that is the beginning to specify that you can do this so now let us see here create a class called a person even if you are not providing that no problem that is just a identification internally it is not going to have any impact on because of providing object so now i am going to create a constructor for the person which includes the name of the person i employ id so self dot name now in order to print that or in order to display that let us say display now assume that the person is apparent class now let us create a class child so here we are going to write person now the same thing if you required you can provide it additionally provide some more parameters like salary and a destination designation so here you can see salary and designation are something which is new to us but the name under other things are already available so do we need to rewrite it here because already you are inheriting also so this is where what you can do is get the new things and the other things whichever perform to the init method leave it to them so now you see here a equal to so that requires name id salary designation name visually id 200 number salary something designation now call display method now you have to see here i am passing here so salary and designation will be directly assigned now this vijay and this id will be passed here and it will call the init method here and through this way it will get executed and now anyhow you are extending the person so the display method can be called so here whatever you are passing here is faster so where you are able to call that and you are able to pass it through that page this is a way you can do it here so in python so there are two forms of inheritance one is single inheritance which we were discussing the other one is multiple inheritance so multiple inheritance where the child that is like when a child is inheriting from multiple parent classes which is we experienced in a c plus not in java to achieve that only in java we go to interface right the same way here so class base class so if you want to write it always leave it object defined self.string equals [Music] where we are just creating a base class and inside that we have created a constructor now similarly let us create an another class and say this as base one so multiple inheritance base one in the classes base this is string one this is string two okay base let me keep it in this base 1 base 2 so that it will be easy for identification so there are two classes one is one class another one is both has their own constructor with the different implementations more say so now is your actual class so now you can say sample base one comma based just the comma and include the other class and now you can say f in itself so where you can call base one dot itself pass the self similarly base two dot in itself as this itself is nothing but just a parameter argument here right so that's it now inside this front sample class now create another def method to say print the strings or display strings because we have created a string but we have never used but what purpose we have created now say print self dot string one comma self dot string now go here which class we are going to create an object for sample class so create an object for sample class and say sample dot display stream that's it so now if you run this you see here so base 1 is called base 2 is called a sample class so all of them happens here so this is calling the constructor of base 1 class and this is calling the constructor of base 2 and to that i am passing the self and then finally here you are getting the string because of the self because of the sample class it is able to retry base 1 string one base to string two also so this is where multiple inheritance is possible so in a simple way just when in java you use implements and you give comma comma and you will add the unimplemented methods but here you are using extents instead of exchange you are using the brackets and you pass any number of methods classes from which you need to inherit the properties straight forward that is and then multi-level inheritance is there multi-level inheritance is like uh class base if you want to create an object or lastly in itself provide a name to just a base class multilevel is nothing but in java we do nested in editors right class ca extends class b class b extends class c class c extends class b the same thing only here so if required this is available in base class so you can say based on name so here you implement only each so get h and similarly class grandchild is extending child so this extends here this extension so here suppose say i am going to pass three more arguments [Music] then already name and age are provided in child child dot gene itself [Music] so now here just create a object for the grandchild and pass the data so vijay 23 some numbers yeah so now we are able to get that industry so this is a multi-level where in java we call it as nested inheritance and then hierarchical inheritance is there and hierarchical inheritance is nothing but like more than one derived classes are created from a single base class so like class a extends class b similarly class c extends class a again class b extends class a and class c also extends class a so in that case hierarchical method of it is there and a hybrid inheritance this is where more than one form of inheritance can be implemented in the same which is like single inheritance along with the hierarchical inheritance are multiple inheritance or multi-level inheritance along with the hierarchical inheritance so like that we can implement it so other things is there anything specific to inheritance yeah so one last part is like so you know in java so even though you are inheriting if you are using a private access modifier some of the methods will not be access sorry some of the variables the com the pro some of the components of the class will not be accessible so in the similar way only here here if you can see here so this uh suppose we are having any variables inside means they will not be able to get access private members but we will not use explicitly the term private here so say class c so define self dot c equals 21. just i am assigning a value and now we will be creating a private variable here called self dot so in general you cannot create a variable here as something so that won't be a private variable so in order to make it as a private variable put a double on the scope and then provide a value and then you say some value to this this is how you define a private instance variable you are not going to explicitly say a keyword private but you are going to use double underscore and map that to so now you see class d is extending the class c and now defined in itself self dot e equal to 90 c dot init so you see here that b is nowhere available for you c is available e is available but d do you see that but it's the same if i remove this you can see the d over here so if you want to make that as a private just add a double underscore before the variable that is how we do it usually this will throw here d has no attribute because it is a private so these are some of the whole chair so for making it as a private we don't have a keyword explicitly called private so we can use double underscore over there and we can conclude that so these are the only two things related to object oriented concept we have in python there are no abstraction interface concepts available here so the next one is about the collections framework so collections framework already we know the basics of that where we discussed about the list tuples and other things so in the collections what we are going to discuss is we have some methods like counters dictionary stick order order dictionary like that so those things we are going to discuss over here so collection module is defined as a container that it is used so basically that is how in java also so it is where we are going to store multiple different types of elements or same type of elements it depends on for example in a tuple the elements cannot be updated in list which we already discussed so here what we are going to discuss this way there are few contents available like counters ordered dictionary default dictionary map chain map name name and tuple dq's user list user stream like that there are six things so we are going to discuss about those things so first of all what is a counter so counters is like a subclass for the dictionary or subclass of the dictionary class dictionary is something which is like a map right so in that particular dictionary this counter falls as a subclass so this is used for the purpose of counting the elements in a iteratable form so because dictionary is unordered so where the key based on the key only your values are getting stored over there right so in order to make them i trouble this counters will be in place so it is like something equal to what we can say okay so first let us go to the countess counter collection so first of all this counter are available with the libraries only so first we have to do the importing of that from collections input counter for example say print counter of this you can see here so this is counting based on the sequence of items similarly based on the dictionary we have the dictionary is key value right of a equal to 3 equal to 5 c equal [Music] so just it is providing that info similarly print counter equal to 5 this is based on you remember the beginning we discussed about the keywords right so like that it will differ so all of them are capable of nothing but counters which is used to count the elements in a i trouble form so it can count either the sequence of items or it can count the dictionaries or it can count the keywords and similarly we have ordered the meaning of order the dictionary is it remembers the order in which the insertion happens so i think uh linked list is the one linked list linked as linked hashtag linked hash map these are the one which maintains the insertion order similarly ordered dictionary is the one which is going to remember the order in which the keys are inserted okay because dictionary is something which is related to key value in that how the keys are getting inserted based on that only value will stop that key getting inserted now in which order the key is getting inserted that will be updated by the order dictionary for example so again this order dictionary is available in a separate class so this library has to come [Music] so now you see for k value in d dot items is nothing but i just created a disk map and i am looping it and getting in which order they have inserted so a1 b2 c3 c4 so now i will create a another variable called ordered ordered a equals i will say ordered dictionary and now i will say order da now here instead of this pass this dot so now if you run this you can see so where this is a normal dictionary which you are inserting so here it is maintaining the orders in which it is getting inserted so since it is a number you may not be both looks similar to you but this is the way how it gets implemented ordered ea of order dictionary is the library you are calling so this library is where for example in a simple way if i want to say ordered a okay and i will see here ordered a of c equals 40. the same i will say here as opposed to remove remove based on key and we are inserting a new value so here you can see so pop which is removing and it is getting added so the insertion of c is only at the end right so it is maintaining that order aspect so this is the way it will work so these are some of the ordered dictionaries similarly the next one is defaulted so this is just to provide some default values for the key that does not exist and that never raises a keyer so which is like default dictionary means providing default value to the key but that value does not exist and it will never raise a key error the meaning of that is this keyword so when you are assigning some value to something in default it is going to throw error right if it is not matching or if it is different it is going to so some such things will not happen here it is just in order to do the insertion some keywords it will create you are creating but that is not going to be used in order to do any validation or anything else you can see here when implementing this is the library this would be equals so here you have to say what is the type of default dictionary so whether it is an integer so you pass it and then you create a list say one two [Music] so you can see here i didn't specify any keys right but we are calling the default edit which is inserting a default key for each and every value okay so as the name specific default dictionary in default it will provide a default value for the dictionary created if this parameter is not available then the error will occur but other than that there is nothing to validate over here it is not even a key because uh how can we say yeah you can keep that way for us ordered a dictionary is the one which is useful because mostly we retrieve the data in order to validate only right and then the next one is about the chain map chain map is nothing but which encapsulate many dictionary into a single unit that is i want to use multiple dictionaries like order detector everything into a single thing means then the chain map can be used for example so now you can see here c equal to chain map of d1 d2 d3 so where encapsulate many dictionaries into a single unit and written it as a list of dictionaries you see here so each and everything is a single dictionary right which is a key value so where it merges everything and provides a single list if you go and verify print c dot so which returns multiple dictionary as a list that is what is this one so now from here if you want to access the values or keys how are we going to access it that is the next thing so for that what i can do is c dot if you provide that it will return you the keys equal so this is the key views and instead of that provide the values it will provide you the list of values values so where just in order to retrieve the key and value so the thing is like so what what happened here is like so you have a dictionary key value key value key value there are three dictionaries now when you are doing the chain map it is nothing but it is creating a list of chain dictionary and inside the list it is putting all the first key value second key value third keyword this is how it looks it does not split that and if it has splitted means it will it has to create two list one is list of keys and another one is list of values but that is not happening it just creates this list so where this group again this is the first dictionary this is entirely the second dictionary this is entirely the third dictionary now when i say value our keys or values these methods when i do that they they are providing but after this what does that mean thing you want to know is values so creating or adding a new dictionary can be done so which is like uh using the new chain there is a method called a new child method this this will create a new dictionary and that will get added to the chain map position one first position it will get added so which is like you give this one d1 d2 d3 and now you go here say chain equals collections dot chain number b1 command d2 print all content okay it will print all the contents or after printing i'm going to create a variable called chain one and i'm going to use chain dot underscore new new new underscore child and i'm going to provide dictionary of d3 and then just print chain one so now this so now you can see this is the chain map a1 b2 so this is the chain because i have given d1 and d2 only d3 is 516 i have given but in real time if you see i am taking c d2 value as a new child and passing as d3 and i am putting it here so now what it will happen this 516 will be added to the beginning so now the chain already the chain is containing only two dictionaries now i am adding the third dictionary so which will get added to the beginning and it will have three dictionaries altogether this is considered to be the chain map creating or adding a new dictionary okay i mean i think after this you can go on couple is only a smaller part let us complete that so the next one is about the tuple so where we call it as here as named double a named tuple is a double which returns object with the names for each position which the ordinary tuples will not be able to perform okay with the names the meaning of that is object there will be object id associated so along with that it is going to update that is what we mean by a named tuple for example so usually we use only tuple right so instead of that we are going to use named double so where i am going to provide the name over here and along with that i'm going to provide the details like what are the details i required name each id so this is how your name in default you will just create it as a tuple that's all you want to do that is the only change so now you can say here create a variable called a string equals student because that is the name here right so you can see here of sample age 28 34 something and provide [Music] now string off now say name so now based on that also the value will be retrieved so that is what the tuple will do named w okay this is about the name where our travel is based on the names as well and not only by the index by using the key name also you can try so here here if you see here this is how we create a tuple over here so instead of that here named we are creating so that is one thing and there are two important factors which is available in this that is conversion operations oneness like underscore make and another one is like underscore aztec as dictionary so i underscore make is a function which is used for or which is used to return a named tuple from the iterable past argument the meaning of that is for example so here action so where we have this information uh yes equal to student named okay and here we have now what i'm going to do is similar to this let me create a list and create it saying that age is 23 and id is 22. so actually this is not a named tuple or anything else but this is just a i trouble so now what i'm going to do is i'm going to create a dictionary and initialize it so how i'm going to do that so for example di or even for now this dictionary later we will come so for now what i can do is already this student is right so yes dot underscore make of life so this is the list so now what it will happen if you see here here you can see sample so this is the one which is having this info name age id this does not have that info nowhere i have specified but since i am making this into a format of this one this format automatically this gets stored in this format how you are saving this no in the same format it gets stored so that is what the make will do which is going to return a named tuple so here you are creating as a named double but a list i have created and converted into a named tuple using the make function okay so now going to the dictionary as dictionary means this function is used for the purpose of written it as an ordered dictionary for example so here say dictionary equals okay so this is a dictionary where we are providing with the key values okay key value plus now what we can do is say di dot so this one so this is the dictionary which i have used this is the order of the dictionary so now this one the string which i have created we are trying to make it as in the dictionary format so now you can see here name is sample age so where it is taking the info from here and it is associating with your age is 28 id is 34. so this is how it works on so these are about the named tuple and the conversion like we have the string conversions right stream to integer integer to character like that the same way these are some of the function where a single list can be converted to a name or a name couple can be converted into a dictionary for that these two functions are used underscore make and does edit okay so that's what so still we have dqs and list in the list there are some of the things like appending insertion extension of the list of these things but similarly in the set we have those information like creating a set those things with that the collections will be over okay okay then bye just a quick info guys if you wish to learn testing and make a career in it then we have a good news for you intellipaat provides test architect master course in collaboration with ibm and microsoft the course link of which is given in the description below you
Info
Channel: Intellipaat
Views: 135,656
Rating: undefined out of 5
Keywords: robot framework, robot framework tutorial, robot framework with python, robot framework beginner tutorial, robot framework pycharm, robot framework tutorial for beginners, robot framework step by step, how to use robot framework, python robot framework tutorial, robot framework selenium tutorial, what is robot framework, python robot framework, robot framework selenium, robot framework for beginner, how to install robot framework, robot framework in python
Id: PdusrIQNFXA
Channel Id: undefined
Length: 236min 35sec (14195 seconds)
Published: Wed Jul 20 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.