Session 1- Python Programming for Selenium — Transcript
Full transcript
- 0:03so from today onwards we are going to start learning python programming because
- 0:08the python programming is the most important thing before learning automation because if
- 0:13you work with any automation tool right the automation tool can understand the language
- 0:18so if you know the programming language well so you will be able to write the
- 0:22good number of test cases and uh effectively okay so from today onwards we are going to
- 0:27start a python programming language so first let us start with some basic concepts like what is
- 0:33python programming and where it is started what is the history and what are the different thing
- 0:38python programming will approach python language will support and also we'll compare python program
- 0:44python language with other programming languages which are already available in the market
- 0:48okay then we will understand why python is become more popular in the current day market and we will
- 0:55see some basic important things and after that i'll show you how we can install python and then
- 1:01we will see how to write a basic programs by using python programming language okay so first let us
- 1:07start with what is basically python what is python so let me just put a few important points here so
- 1:15python is basically in high level general purpose programming language the first point python is
- 1:23high level general purpose programming language so which which contains a multiple words here we need
- 1:29to understand individually so high level is one thing and general purpose and programming language
- 1:36so we need to divide the sentence then we need to understand clearly what exactly python means
- 1:41so python is a high level programming language what is high level means which is user friendly
- 1:48so everyone will able to understand the language if i write some code in the python everyone will
- 1:53easily understand it is more user friendly language and what is general purpose general
- 2:00purpose means by using python we can develop any kind of application it can be web application
- 2:06or mobile app application or desktop applications all kinds of applications we can develop by using
- 2:12python language so it's a general purpose so which is high level general purpose programming language
- 2:20now which is open source language open source means what it is freely available
- 2:24even java is not a free software so till java 8 free support is there after java
- 2:298 whatever versions you are going to install we need to buy some license
- 2:33if you are using java inside any companies but python is completely open source so we don't need
- 2:40to pay any money for that so we can just download and install i can start work with the python
- 2:46and the third point is platform independent most important feature so what is platform independent
- 2:52means we can install python and we can write a python program in one environment and we can run
- 2:57the same python program in another environment for example if you write your program on windows
- 3:02operating system and you can execute the same program on linux operating system or mac operating
- 3:08system everywhere so python is a platform independent and there are some programming
- 3:14languages which are completely platform dependent like c sharp but java is also platform independent
- 3:21so like java python is also platform independent okay so these are the three important points which
- 3:28we need to remember before starting python language so python is a high level general
- 3:32purpose programming language which is completely open source and it's a platform independent
- 3:39now let us compare the python with other languages why python is very easy to come
- 3:45easy when you compare with the python with other languages so why most of the people
- 3:50will feel easiness so when you work with the python language so let me just share a small
- 3:59picture then you will able to understand why python is exactly why python is more simpler than
- 4:07other programming languages because in the python we can simply write
- 4:11one single line statement in other programming languages we need to write
- 4:14multiple lines of code okay so let me just share a small screenshot hold on okay
- 4:25yeah now we can just look at this small picture and here i mentioned uh four programming languages
- 4:32okay one is python and c c plus plus and java and if you want to write a simple line
- 4:38or if you want to print something in python we have to just write only one single statement
- 4:43in the print we have to just specify whatever you want to print but if i just look at other
- 4:48programming languages and just look at the java here so the fourth one is a java point
- 4:53so if i just look at here if you want to print a small message at least we have to write three
- 4:58to four lines of code in java at least we have to write three to four lines of encode code in java
- 5:04and similar if you just go with c c and c plus plus also we have to write multiple lines of code
- 5:10so you can just look at with a simple example how python is very simple and very easy to learn
- 5:16but here if you want to start with java or c or c plus plus we need to again understand multiple
- 5:21keywords here what is in what is main what is printf what is written and if i start with java
- 5:26again we have to understand what is public class right public static void means all these things
- 5:31we need to understand but if you come to the python it is very simple language and with single
- 5:38statement we can just print some output so this example says how python is very easier than other
- 5:45languages okay if i write of 1000 lines of code in c java you can simply do the same thing within
- 5:5350 to 100 lines of code in python so because of easiness so that's the reason people are start
- 6:00learning python instead of going for java directly okay so python is very easy to learn and now
- 6:12python is a very easy language when you compare with the other languages now when i see the
- 6:18history of the python for example which language is coming to market first java or python so most
- 6:24people i think java is a old language than python right so actually the python is a very older
- 6:32language than java so python came into the market in 1980s only so 1980s the python came into market
- 6:41but in the 1990s java came into market but from the last 20 to 25 years java becomes very popular
- 6:50in the market than python but from the last five to 10 years python is becoming popular
- 6:56in the current market but why python is not that much become famous in the earlier years in the
- 7:021980s even in the 90s 1980s only the python is introduced after that java is came into market so
- 7:11there are multiple reasons are there so actually the python suppose in 1995 or in 1990s
- 7:19so we have only desktop applications we don't even have web applications at that time so whatever the
- 7:26market trending or market requirement at that time you have only java language is supporting
- 7:32more and java is more compatible at that time to develop those kind of applications and that
- 7:39is the reason java becomes very popular at that time in 1990s and 2000 from 2000 to 2010 2015.
- 7:47so during those years java becomes very famous in the market but after that what happens uh there
- 7:54are new trending technologies are coming into market like data science or big data or neural
- 7:58networks artificial intelligence especially these technologies java is not performing well more than
- 8:07the java so python is preferred because python is exactly a suitable language in those technologies
- 8:14so that is the reason the python trending is started now so python becoming very popular in the
- 8:20new trending technologies okay so using java just desktop applications or web applications or
- 8:27mobile applications you can develop but python by using python we can also develop
- 8:32web applications mobile applications as well as desktop applications but apart from that
- 8:39which is also more useful especially in the new terminal technologies like big data or artificial
- 8:46intelligence data science and so on okay so that is the reason python is becoming very popular in
- 8:52the nowadays so in future also maybe automation is also completely may move to the python programming
- 8:58because recently it is started python along with automation so initially automation is
- 9:04started with the java language because most of the web applications are developed using java
- 9:09so even selem is learning with java most of the people but recently people have started learning
- 9:14silly name with python language also because python is also supported in selenium okay so
- 9:20if i just come to the history part actually this is implemented python was started in around 1989.
- 9:28so here guru van rozam so he's a name of the other for that python programming language
- 9:35and at that time he's working on cwi company in the netherlands in 1991 so this guy published
- 9:42actual code so the initial version of python is 0.9.0 and after that they have added so many
- 9:48things in the middle versions like 1994 they have released python 1.0 and again which is introduced
- 9:56on new features like lambda expression map filter reduce all these things because developers this
- 10:01is very more useful for developers but they are newly added some futures at that time
- 10:06and after that 2.0 is also added uh new features like comprehensions garbage collection and so on
- 10:13and 2008 python 3 is got released and which is also called as a pi 3k and as soon as the python
- 10:213 got released from that time slowly python started become popular or famous in the market
- 10:28and actually python is a language which is written based on other two languages called abc
- 10:34and modular three so these are the two languages which were there at that time in 1980s so initial
- 10:40languages when computers are introduced in the market at that time we have only machine
- 10:44languages are there so these are the two languages are there at that time so based on them based on
- 10:50those languages python is started introduced so this is a basic history so there are multiple
- 10:55versions are there in the middle but as soon as python 3 started and people have started using
- 11:01it in multiple trending technologies and which is more compatible with the latest technologies
- 11:07all right so this is a simple understanding or basic understanding what is python and where
- 11:12it is started so if anyone if anyone asks you which one is a older language python or java
- 11:18so always python is older than java okay so python is a older language than java but java become
- 11:24very popular in the 1990s and 2000 years but now again python is becoming very famous in the market
- 11:31okay but when you compare these two languages python is very old language when you compare with
- 11:36the java okay so now let us see how to download and install python and i'll show you some basic
- 11:44programs how we can write a program and how we can compile it and how we can execute all these things
- 11:50and we have so many uh so much of flexibility in the python it's not like java so it's very simple
- 11:56and uh downloading software installing writing a program execution in everywhere you can just find
- 12:02easiness if you already know java programming you you definitely feel the easiness while learning
- 12:08the python okay now let us see how to download and install python on windows operating system it is
- 12:15almost same in the mac also so just only installer is different okay so how to download and install
- 12:22python so to download and install in python you can just go to the python official website you
- 12:27can just search for download python and which will open a python official website this is a download
- 12:35python python.org just go to this website now you can just go to the download section directly
- 12:43or the home page itself which will show you download the latest version of
- 12:46for windows and by default it is giving windows so and if you want to download mac you can just click
- 12:53on this link mac os and if you want to download windows you can just click on the windows link
- 12:58here and then it will navigate to windows python releases for windows and again 2 is also there
- 13:043 is also there so three is always latest and all the new implementations are available only
- 13:10python three okay so always download python three so when you just click on this link
- 13:16as soon as you click on this link which will start downloading the software
- 13:24okay i just click on that link just a moment
- 13:32okay so once you click on this link it will navigate to another page now you can just
- 13:36look at here i'm just clicking on the python 3 release python 3.9.6 so this is the latest version
- 13:44all right so if i just come down here there are multiple links also there again even in
- 13:49the windows also there are again 32-bit 64-bit is there right so now what we can do is we can
- 13:56just directly click on the windows installer 64-bit so now it is started downloading so i
- 14:03already have a download file just discarding this so once you download you will get installer file
- 14:11okay i'll show you what is that installer file here so here this is the installer file
- 14:18so you can just look at here python 3.9.6 amd64 dot exe this simple executable file you will get
- 14:26so once you get an exe file you can start installing the python so i will share a small
- 14:31document here you guys can try this on your mission so it just provided the download link
- 14:37here and once you downloaded your software or if you go if you are using mac so you can just
- 14:42go to this link and download the software okay so you will get an installer file like this so
- 14:48once you get an installer file you can just double click on it and then it will start installing the
- 14:53python it's very simple and straightforward and then it will open the installer screen like this
- 14:59and just select the first one install now and this is the actual default location where your
- 15:05python is going to install c uses admin app data local programs python python python39
- 15:12so this is a default location if you want to customize it if you want to install in some
- 15:15other location you can just customize installation then you have to browse the path okay so let it be
- 15:21the default location and here these are the two options are recommended install launcher for all
- 15:26users and add python 3.9 to path so select these two check boxes and then say click on the next
- 15:33so after that it will start installing your python it will take a few seconds of time and after that
- 15:40finally you will get this screen setup was successful so this is the only thing you have
- 15:45to do just three to four screens are there you have to just download the installer i provided
- 15:50the direct link here if i just open this link you will get this screen and you can just click on it
- 15:54you will download 3.9.6 is the latest version as of now okay so just go through these screens
- 16:02and you will able to install it is very simple and straightforward okay so this is the default
- 16:07installation location of your python so in the users admin app data local programs python and
- 16:14here you can see the python along with the version number this is a default installation location but
- 16:21once you install your python so how we will know whether python is successfully installed or not
- 16:27so once you've done the installation what you have to do is you just open the command prompt so on
- 16:33windows you can open the command prompt or if you are working on mac you can just open the terminal
- 16:38so once you open the command prompt like this just type python here so before installing the
- 16:45before installation if i just type python here it will show you the invalid command error but once
- 16:51you install your python and then open the command prompt and here just type python here then it will
- 16:57automatically show you the version number which python version you have successfully installed
- 17:03so you should get this version number that means you have successfully installed python simple okay
- 17:10so once you install your python you can write a python program anywhere you can just write in
- 17:15the notepad or command prompt or python itself is provided some kind of ides so we can also write a
- 17:22python program almost everywhere wherever you want to write your python program you can write it and
- 17:26you can compile it okay so it is very very simple so i'll show you how many ways we can
- 17:32write a program how many ways we can execute our python program so here let's go back and here i'll
- 17:39provide this document so you can just go to the document and install the python software and once
- 17:44you open the once you install the python software just open the command prompt and then give this uh
- 17:50command call just say python so that will give you version so if you are getting version means your
- 17:55python is successfully installed okay so guys are you able to do that it's very simple installation
- 18:02and just you need to download the software click on the next next next and it will finish it off
- 18:08i'll share the document after the session okay all right so once you download install
- 18:14on python on windows so the next thing is we can write a python program any place and we can run
- 18:20in many ways now i'll show you how many ways we can run the python code how many ways we can run
- 18:27the python code so i'll show you many ways but finally we will use one ide which is called pi
- 18:33champ pychamp is a the most popular ide where we will write all your python programs we can execute
- 18:39and everything even our automation skips also we are going to write in the pie chart so pycharm is
- 18:44the most popular editor which is available for python language even eclipse is also supported
- 18:49even eclipse also we can write a python program and we can execute but we have to additionally
- 18:54install pydev plugin within your eclipse if you want to work with eclipse we have to install
- 18:59pi dev plugin within the eclipse and we will do that but especially eclipse is only for java okay
- 19:05so most of the java developers will prefer to use eclipse but if you start working with the python
- 19:11better to go with the pycharm so which is the most popular editor which is available for python okay
- 19:17so before installing pi champ and everything i'll show you the general way of writing the program
- 19:22and execution of the pi program so the first thing is as soon as you install your python right
- 19:27python itself is providing some kind of editor called ideal if i just search go for idle so id
- 19:35le so by default the python will give you this client or we can say id integrated development
- 19:42environment so what is id means id means the editor so where we can write something suppose
- 19:48i'm using here notepad right if we want to write something i'm using a notepad so notepad is an ide
- 19:53similarly if you want to write your python program so we need to have some id
- 19:58and some ids will be by default we have python will give you and some ids we can externally
- 20:04download and install so by default uh python is giving one ide called idle id led and search for
- 20:14idle on your search bar of windows it will automatically pop up and just click on it so
- 20:21once you click on it which will open the window like this okay this is a ideal window and in this
- 20:29directly you can just write the python code so for example i want to print a simple message in
- 20:34python simple write one statement print you can just say in the double quotations hello world
- 20:42okay and then say bracket close and enter now we will get the output here this is output of the
- 20:48program simple line i have created suppose i say print 10 plus 20 enter now we'll get the 30 year
- 20:58so this is simple id which is provided by python itself but this is not going to use as a beginner
- 21:06you can just do some practice on this but actually in the projects we don't prefer to use it okay and
- 21:12these are all dynamic ids dynamic ideas in the sense as soon as you press enter the statement
- 21:18output will be printed here directly okay so this is idle so this is one of the editor which we have
- 21:26so which is also called as a python shell okay the other name is a python shell we can call it as a
- 21:32python shell so run a python code through idle so how we can open the idle we can simply search for
- 21:39idli and you don't need to install this separately by default you will get once you install python
- 21:47okay so in the python editor so this is a basically command prompt this is also
- 21:51command prompt so we need to execute everything here we don't see any ui here okay so run python
- 21:57code through idle this is also called as a python shell and the second way is we can also execute
- 22:04our python code through command prompt through command prompt also we can execute our python code
- 22:12but how we can do that let me just close this open the windows command prompter it's a cmd
- 22:19and which will open the windows command prompt so this is your windows command prompt
- 22:24so once you get the windows command prompt here you can directly write your program
- 22:29okay so here directly you can execute your program how to execute it so let me show you so
- 22:35for example here i can say uh i say python okay so as soon as you give a command python so now
- 22:45python command prompt is opened so you can see three greater than symbols so once you see the
- 22:52three gated symbols from here you can just start writing the python code python programming code
- 22:57okay so for example i say x equal to 10 and y equal to 20 now i want to print x
- 23:05plus y i say x plus y so then you will get 30 so now we have written three lines in the python
- 23:13code or if i just directly can say print 100 plus 200 i'm just showing a simple how we can write a
- 23:22program and i how we can execute through command prompt so this is a another way we can just write
- 23:28the python code and execute wherever you want just we need to go to the python command prompt
- 23:33how we will get the python command prompt here you can just say python and then automatically
- 23:38it will give you the python command prompt and from where you can start writing your python code
- 23:44okay but suppose in both the ways so here this is a command prompt
- 23:49and here i have a ideal so these two things work exactly the same way there is no much
- 23:54difference between these two so this is actual command prompt which is from default windows and
- 24:01this is additionally which is provided by python itself and both are working in the same way but
- 24:07here we cannot save this code as a single file okay suppose tomorrow i want to refer the program
- 24:15and it is just dynamically taking the data and it is dynamically giving the output
- 24:20but i want to save my program as a separate file and tomorrow i want to run my program
- 24:25right so that is not possible in these editors so for that what we can do is we have to go with
- 24:31some other way so we can also write a program in some file and we can execute that file as a python
- 24:39program so that means we can also run the python code we can also run the python code through
- 24:47notepad or notepad you can use any editor you can just write a python code and that particular file
- 24:53we can execute everywhere so now i'll show you how we can write a simple python code in the node
- 24:58pattern how we can execute let me just create a simple node pad file and i am giving tester dot
- 25:04and always in the python file should have p y is an extension not a txt
- 25:10okay remember that so whenever you create okay whenever you want to create a python file
- 25:17that extension of the file should be dot py dot py so now we can just open this file
- 25:25or anywhere you can just open in 8 plus plus or any anywhere you can use
- 25:29like even the notepad also i can just open so i'm just opening it edit plus plus
- 25:35and this is the editor i got or you can open this file in the notepad also no problem
- 25:40and here i'm writing the python code i say x equal to 100 y equal to 200 i just want to print the
- 25:45result of x plus y i say x plus y so three lines of code i have created and now saving the file
- 25:53and you can just close the file so now this file is representing one program in python program
- 26:00now i want to run my program through this file so how we can do that again go to the command prompt
- 26:08and here you can just say python right so here we need to specify it so what is the
- 26:16test dot py right so what is the location of the file you can just go to the properties
- 26:21and which will show you the location get this location and specify just paste it over here
- 26:30edit paste here if it's not able to paste just open the command prompt one more time
- 26:39copy the location whichever file you have created you have just copied slash the name
- 26:43of the file is tested dot py test dot py so along with this python keyword just specify the
- 26:51file which file you want to execute in that file we have written a small program
- 26:56now enter now as soon as you say enter it is giving the output of that program
- 27:03okay so this is how we can run the python program which is already created in some file
- 27:09so these are all different ways we can write our program and we can execute in multiple places
- 27:16so mainly these are the three things one is we can run the python code through idle which is
- 27:20a default id which is provided by python second thing is we can run the python code through cmd
- 27:27that means dynamically we can enter all the code in the command prompt itself
- 27:32and the third approach is we can write a python code or python program in a file
- 27:37it can be any file and uh then we have to save that file as a dot py extension
- 27:42and then we can execute that file from anywhere from your
- 27:45operating system from the command prompter so but you have to just give python is a command python
- 27:50specify the location of the file that's it which will give you output of that particular file so
- 27:56this is how normally we can run the python code or python programs in multiple ways
- 28:02but when you're working on real projects on day to day basis we don't prefer all these things
- 28:09okay so we need a kind of an editor or ide and like which is ui based and all the menu options
- 28:18should be there icon should be there and the result console window should be there so everyone
- 28:23should be everything should be there on the editor itself and it should be more flexible and
- 28:27sometimes it should able to give auto suggestions right so it makes our job very very easy
- 28:34so for that we need something different kind of editor so for that we have to go for pie charm
- 28:43pie jump is a most popular popular ide for python especially for pi for python
- 28:51okay so now let us see how we can download this id because while learning the python and also by
- 28:58learning the psyllium so throughout our sessions and extra sessions all the sessions we are going
- 29:02to use pie champ itself okay so now i'll show you how to download pie champ and how to install it
- 29:09and then we will see how to work with the pie chart how to write a single python code and
- 29:13how we can execute how we can see the output all these things so to download and install on python
- 29:19what you have to do is just go to the google and say download pie charm okay so once you
- 29:27search for download python for python or just say download python which will automatically
- 29:33give you some urls here so jet brains is actually company which is developing lot of products and
- 29:40pie jump is a one of the product among them so just go to this location and now you can
- 29:45see pycharm is also available for windows mac and linux and whichever operating system you
- 29:50are currently working just choose that particular tab here so currently we are working on windows so
- 29:56just go to the windows and again you can see two options here professional and community
- 30:02so professional is actually a free trial is available for few days but after that which
- 30:07will expire you have to pay something about it because it's not completely free but if
- 30:13you install professional we can just develop our html js sql and so many other support is there
- 30:19but we don't need all these things so just we can use community version this completely uh
- 30:26for pure python development okay which is completely free and open source we don't
- 30:31need to pay anything for that okay so but if you go with the professional version we will
- 30:37get some more advanced features uh in python again anyway we are not going to use all those features
- 30:43uh then we can go with the community version okay so let's go and click on the download
- 30:48here as soon as you click on the download which will start downloading the pycharm
- 30:53so i already downloaded it so we can just look at this this is a this is a icon you can see pie
- 31:00champ iphone com community pie champ underscore community so this is the id which we need
- 31:09okay so just pyjamp is not enough okay you have to download python also so first you need to install
- 31:16python completely and then download pie chart okay so now i already downloaded one piece of installer
- 31:27here so this is the installer so let's need to install this pycharm so to install this pie charm
- 31:33because when you download in a pie jump also by default pycharm will comes with some kind
- 31:39of virtual environment of python okay but if you want to really work with the python like
- 31:44development on automation everything so later on we have to install a lot of new packages so python
- 31:50should be there so whichever python software we have downloaded installed that should be there
- 31:56uh inside the pi champ so i'll show you how to configure our pycharm with our existing python
- 32:02which we already downloaded and installed okay so the next two step is we have downloaded this
- 32:08pycharm so i again have created a small document here you can just look at this
- 32:13so go to this website and you have to just download the software and here i provided
- 32:18screenshot also same thing which i have shown you and this is the installer file so once you
- 32:24get this installer file you can just double click it will start installing the python it's a very
- 32:28simple steps also it just it will give you one more screen like this and click on the next and
- 32:34uh this is a default location of pyjama and you can just have this location and click on the next
- 32:41and then and in this window you just select the first one python community edition
- 32:47and second one is add a bin folder to the path so just select this option because by default
- 32:54a python path should be added to the environment variable of your windows otherwise we have to do
- 32:59manually later so better to have check these two boxes python community edition and the second one
- 33:06update path variable and then click on the next so once you click on the next you will see one
- 33:10more screen like this and here you have to click on the install so once you click on the install
- 33:16then it will take some time and it will install and once you complete this process and finally
- 33:24you will see this window and it will ask you to reboot your mission okay so once you install this
- 33:30you have to reboot completely and then only the python works properly so you can just select the
- 33:36checkbox second checkbox i want to manually reboot later if you select this one you can later on you
- 33:41can just reboot but you can select the reboot now the first checkbox that will automatically reboot
- 33:47your mission after clicking on the finish that means your mission will be restarted
- 33:52that's it so this is how we need to just install the pycharm so these are just the basic steps i
- 33:57have captured the screenshots and this is again latest version of python screen so you don't need
- 34:03to worry at the time of installation because you will see the same screens okay all right so once
- 34:09you install your pi champ right so first time when you install your pycharm you will get a small icon
- 34:16on your desktop so you can i'll show you that so this is a simple icon you can see on your desktop
- 34:25or else you can just search in the search box you are not able to see the icon you can just search
- 34:30for here pie charm community edition so now let us open this and as soon as you open this [Music]
- 34:38and which will show you a beginning window like this as soon as you
- 34:46click on it so this is first uh first screen launching python so as soon as
- 34:53you click on that first screen will be like this and by default it is providing the dark
- 34:57dark theme and if you want to change the theme you can just change it i'll
- 35:02tell you how to change it i already changed it actually just a moment
- 35:09i'm just removing all these things
- 35:15okay so by default uh you will get this window and if you want to change the theme and you can
- 35:22just go to customize and here you can change the color theme okay i already changed it so and if
- 35:29you want to increase the pi charm font which will give you very smaller you cannot see that
- 35:33font most of the time so if you want to change or increase the ide font you can just increase
- 35:39number here okay and by default you will see four options first time when you launching your python
- 35:45and projects customize plugins and learn pie charts so you can just go to the project
- 35:51so in this window you can see three options new project which is creating a new project and open
- 35:57means which will open already existing project and get from vcsps any version control system like git
- 36:04or github is available from there also we can directly get the project so what is the project
- 36:08means we have to create a new project first because later on we will do all the stuff inside
- 36:14the project itself okay now let us create a new project so i'm just clicking on the new project
- 36:22so as soon as you created the new project so you can just browse the location where you want to
- 36:28create your project okay wherever you want to create project you can just browse the location
- 36:33you can just click on the browse here and you can show the location wherever you want to create a
- 36:38project and uh later on whatever the stuff we are going to do whatever programs and course scripts
- 36:44everything will be stored in that particular project so i have given some path here inside
- 36:49users admin python project and here i am saying uh some different name in the python projects i say
- 36:56python try name okay so this is a project name i have given python training and after that you
- 37:05can see some options here so basically what are these options is mainly this one okay so
- 37:12this is actually virtual environment which will automatically created and mainly base interpreter
- 37:17so what is this base interpreter means so at the time of python installation so by default this
- 37:23base interpreter will be something different so by default pi chomp also comes along with some python
- 37:29installer files but if you want to configure our own python with the python so we need to
- 37:35specify the base inter interpreter so what is this base interpreter is basically the location of the
- 37:41python which have installed earlier if i just go back i have already copied that location if i just
- 37:47look at here this is a location where actual python is installed so let me just open and if
- 37:53i just go individual folders you cannot see that because these are all hidden files okay so first
- 37:59let us go to the till app data i'll show you that so just go till app data now you can see local
- 38:07inside this local you can see programs so these are all hidden folders okay programs inside this
- 38:14python and inside this python three line so this is actual location of your python installation
- 38:20and you can see something called python.exe okay so if you want to configure our own python in the
- 38:26python so we need to specify this location as a base interpreter and this is a base interpreter
- 38:33so now go back to your pie chart and make sure and this path is correctly there or not
- 38:39so i already configured earlier so it is giving this one by default it will not show you so in
- 38:44that case you need to click on the browse and then you have to provide that path completely
- 38:49okay and then your base interpreter so whatever python you have already installed
- 38:53your pi champ is going to use that particular python okay so have this information and then
- 39:01only these are the only thing you have to check and then you have to provide your project name
- 39:06and this location is optional you but whenever wherever you want to create this location you
- 39:10can just create and browse it so once you have done this click on this and here it will ask
- 39:15you create a main dot py welcome script we don't need any default pi uh python program anything
- 39:21so we can just remove it create so once you have done this which is going to create a new python
- 39:28project so in the going forward whatever python programs we are going to create should be part
- 39:34of this project so this is just one time task all right so now okay it is saying some error so error
- 39:42configuring sdk so basically there is a conflict between the pi champ sdk software development kit
- 39:49which is by default coming comes along with the pie chart no problem so now we can just
- 39:55close that window and now we created a new project here python training okay so once you created this
- 40:02let us start creating a simple program in this so before that every day i will create a new folder
- 40:09inside this project okay so instead of writing all the programs in the project directly what i can do
- 40:16i'll create a new folders inside the project and inside the folder like day one day to day three
- 40:22and in every day whatever programs i am going to explain should be part of those folders
- 40:26now select the project and the new select the directory so here we can call it as a
- 40:32directory which is equal to folder now here we have to provide the name of the directory i say
- 40:38day one okay so day one and i just created a new folder so as soon as you created a
- 40:46new folder you can just create a simple python program for that we have to create a new file
- 40:52or you can directly select the python file you can just select the file or python file
- 40:57anything is anything is fine if you select only file you have to give the file name
- 41:03like my first program dot p y so dot p y you have to provide and you can just give any name
- 41:11to the program the extension of the file is dot p y should be given and then the new file
- 41:17is created and editor is also open here you can write a java python program here the other way is
- 41:24i can just delete this and other way of creating the file is like this i'll show you now close this
- 41:40you already deleted so okay just delete this
- 41:49okay it's not deleted yeah cancel
- 41:55so refresh somehow it is not deleted okay no problem so let it be there so let me just
- 42:00create a new file by using python file okay let me just create a python file
- 42:06so in this you want to give the extension just you have to provide the file name that's it i say my i
- 42:12say my file name is i say hello world okay hello world just enter then automatically which will
- 42:19create a new file called helloworld.py so here you need to provide an extension for that somehow
- 42:26the first file is got hanged i'm just closing okay so let's go to the second one hello dot py
- 42:33so this is how we can just create a new python file so whenever you want to write a simple
- 42:37program or first program you can just create a new python file so how the what is the extension
- 42:41of the python file dot py is a extension of the python file so as soon as you open the file
- 42:48somehow these files are not closing let me just close my python once again i'll open it once again
- 43:15just to give me a few seconds it is time to launch
- 43:30okay now it opens my project okay now i have closed my first file and first file already
- 43:37deleted so now it is updated so you can just close my editor also now this is a new file
- 43:42which you have created so like this you can create any number of python files inside the directory so
- 43:48let's just double click it will open the editor so here we can write our python program so by default
- 43:54it will give you a very smaller font here right uh i can say here i can simply say this is my first
- 44:05python program so you can see here this point is fine you're able to see here right but sometime
- 44:11by default it will give very small font so if you want to change the font or increase
- 44:16the font you can just go to the file and here you can see something called settings
- 44:22inside the settings just go to appearance behavior and under appearance you can just say
- 44:30editor not appearance go to editor inside the editor you can see font okay so here you
- 44:36can increase the font if you want to see l big characters okay and say okay automatically the
- 44:41font will be increased so now this is the first program i'm just going to create so here i'm
- 44:47just writing simple call simple print statement print so whenever you want to print something
- 44:53you have to use print method or print the command print in the bracket we have to keep
- 44:57whatever you want to print i say so hello world and uh this is my first python program and like
- 45:09java here we don't have any semicolons end of the statement nothing here just a plain statement it's
- 45:15very similar to english language you get everyone easily understand the statements okay so here we
- 45:20don't have any semicolon even though if you keep the semicolon nothing happens here no problem at
- 45:25all okay so but have written simple statement here but how to execute this statement so to execute
- 45:31statement just right click here and then say run hello world or you can directly if you want to
- 45:36run you can just use run button will be enabled here and that you have to click let me save the
- 45:42file okay let me just run as a hello world okay so it is giving some error related to interpreter
- 45:50so you can see python interpreter is not properly configured so we have to configure that
- 45:55so let me select this then say apply and say overturn so next time it won't ask you anything so
- 46:03now we can see the program is output is displayed so this is a a terminal we can say console window
- 46:09and which will automatically displayed here as soon as you executed your program
- 46:14and suppose i'll take a x equal to 100 and y equal to 200 i want to perform some of these two numbers
- 46:21and print the output in the console window simply we can say print 100 plus or you can say x plus y
- 46:30and then execute so now we can see this is the output of the first statement
- 46:35and this is the output of the print statement okay so in this editor we can write a simply
- 46:42python program and which will give you the result in this console window
- 46:48so now you can see how the green button is enabled you can just use this to execute your
- 46:52program okay so this pie jump we will discuss a few more options in the python slowly one by one
- 46:58but this is a way we need to first create a new project inside the pi champ then you can create
- 47:05any number of files inside this project so every day i will create a new folder or new directory
- 47:10like this day 1 day 2 day 3 and so on and i will keep all the programs inside this files and later
- 47:18now i am just closing my file so later on i want execute the same program then again go again open
- 47:24the file because the file is always will be in this folder itself which will not be deleted so
- 47:30again you can execute this program so you can run any number of times once you write your program
- 47:36okay so this is how first we need to open the pie charm and then create a new project
- 47:45and just create a new file python file always the file name should be dot p y and you can just
- 47:50simply write a program and execute okay so now we will discuss a few important programming concepts
- 47:57so till now we have just seen how to install and how to do setup everything so i can just share
- 48:04this document and even pie champ installation also have given in this document you can just go
- 48:09through this and you can install yourself okay it's very simple and straightforward are you
- 48:16guys able to do that please confirm in the chat window can you do this by seeing this document
- 48:23same steps you have to perform okay nothing new because this is the latest version by champ i
- 48:28have tried and latest version of python so you don't see any new thing other than this document
- 48:35okay so it is always suggest windows operating system to practice everything
- 48:42okay because in the real-time environment you don't use linux operating system to write
- 48:46automation code so linux is basically used for the servers if you want to install any database
- 48:51servers or any web servers the linux mission will be used even mac also will not be used most of the
- 48:57times okay fine so i'll share this document and you guys can try to install python first
- 49:04and install pycharm and get ready environment okay now i'll show you a few important things related
- 49:11to the python programming language so if you want to start learning any programming language right
- 49:16suppose if you start learning an english language how we will start learning so first we will start
- 49:20like alphabets and then we will start how to write the words and then sentences and then
- 49:24paragraphs and so on right similarly if you want to learn any programming language the same order
- 49:30we have to follow the first we need to learn some basic things like comments or data type operators
- 49:36right and after that slowly we will learn control statement looping statement and there
- 49:40are many concepts we have in the programming so now let me show you something called comments
- 49:46what are the comments in program so basically comments are used to write some description
- 49:55about the application like a logic so suppose what is the program the program contains a number of
- 50:00statements to today you have created some program like this right so we have written some statements
- 50:05like this and tomorrow somebody is trying to read your code and how they will know what exactly how
- 50:12written in this your statement what kind of logic you have written so whatever you have written
- 50:17in your program can just write some description because the code will be more readable to others
- 50:23so others will feel very easy to understand your code by reading your code okay so for that we
- 50:29need to write some kind of description which is basically called as a comments
- 50:33so what is the main importance of comments so basically the comments are used to write a
- 50:40small description about your application logics to understand the logics very easily somebody
- 50:45somebody else can easily understand your code and basically the main purpose of writing comments is
- 50:51improving the readability that's the main objective of writing the comments
- 50:55so the main object of comments that code maintenance will become very very easy and
- 51:00the comments are non-executable code what is the comment comment means non-executable code means
- 51:06python will not execute the comment so for example i have written this statement let me create one
- 51:12more program i am just closing this so let us create a new file and i'll name it as a comments
- 51:21dot py this is another python file okay suppose i want to write some description here or like
- 51:27say other name and designation and everything we created this program and everything i will
- 51:31put some comment for example name of the programmer let's say name of the programmer
- 51:37okay and then designation and then which offer of which application is writing all these things
- 51:43okay so like this if you want to write some description you can just put them in the
- 51:47comment section like say hash so hash used as a commenter so whenever we say
- 51:53hash these statements are become comments so python will not execute the statement at runtime
- 52:00so python will just ignore the statement because these are just a comments so like this whatever
- 52:06code you have written in your program you can just write comment for all the statements
- 52:11and that will increase the readability of the code okay so python will just ignore the comments
- 52:18just ignore the comments suppose sometimes you may have only one line comment and sometimes
- 52:23you may have multiple lines comments but how we can represent them so for example in this i'm
- 52:28just writing a simple statement i say print okay so here uh i'll put some statement i'm working
- 52:37with i'm working with python so i've just written some statement here so i'm just executing this
- 52:45and then you will get the output so every time it is asking here instead of configuring this python
- 52:50interpreter so just configure that the project level go to the project go to the file settings
- 53:02okay so here this is a project for python interpreter so here we don't
- 53:07have interpreter associated so here select the interpreter if you do configuration here
- 53:12every time it will not ask you okay so every file it is asking to specify the python interface so
- 53:19once you've done the setting here it will not ask you again and say apply end up okay
- 53:26okay now i have just written a simple statement here now when i execute this
- 53:32let me execute the code so once you configure interpreter it is getting some files internally
- 53:39okay let me just execute so now we got some output so i want to write some description
- 53:45about the statement suppose if you want to write a single and comment hash is a symbol
- 53:51hash and you can simply write a simple message let's say this is a python program
- 53:58like this you can just a single write a single line comment
- 54:01suppose if you want to write a multiple lines comment then how we can do that so i want have
- 54:06written three four five lines of code i want to comment all these lines so i want to comment
- 54:11all these lines so simply what you can do is you can in python we can use three double quotations
- 54:18beginning and here also three double quotation at the end now all these statements are considered as
- 54:24a comments this is the one way you can do that the other way is you can just have multiple statements
- 54:32and you can also use single quotations three times and here also single quotations three times
- 54:39so this is also considered as a command this is also considered as a comment so this one
- 54:45and this one and also this one so anything is fine and single and comment you can use a hash
- 54:54but is there any shortcut keys available yes suppose i don't have a command for this
- 55:01and i want to comment this single statement we have a control select the statement i say
- 55:06control forward slash control forward slash so cd rl control plus forward slash then automatically
- 55:15that line will be commented now if you want to remove that comment then again control slash
- 55:21that comment will be removed so for adding comment and removing comment the same shortcut key can use
- 55:26control slash similarly suppose i want to comment multiple lines what is the shortcut key we have
- 55:36so if you want to comment multiple lines select all the statements whatever you
- 55:39want to commit i say control shift to slash so shifty is newly added ctrl shift
- 55:45slash so control slash shift i guess let me just check it here and if you don't know the
- 55:52shortcut you can just refer under the code you can find the options which are available
- 56:00okay now can you see comment with the line control plus slash is there comment with
- 56:04the block command ctrl shift slash yeah it is correct on ctrl shift
- 56:09forward slash so i say ctrl shift forward slash still not working
- 56:18yeah just a second
- 56:22okay so for multi line comment also it is uh saying control slash because this again
- 56:28single singles single and comment only for every line we have to give the slash right
- 56:32so if i say only control stars here for every line it is adding slash slash but i don't want
- 56:39to do like this i just want to comment all the stuff at one shot let me try from here
- 56:46and basically this option is disabling
- 56:51comment with a line control slash and comment with the block statement
- 56:57this option is there but it is somehow disabled okay we'll see that
- 57:04okay so i have not selected anything just go to the code and still it is not enabled okay
- 57:08so somehow it is not enabled actually if you want to block the if you want to comment block
- 57:14of statements normally we use this option comment with block statement control shift
- 57:18slash should work so that we will see later somehow it is not working fine
- 57:23okay so if you want to comment multiple lines also you can just select them
- 57:26control slash you can use and again if you want to remove them you can just select all of them
- 57:31i can say control slash once again or if you want to zoom it manually you can say three string is
- 57:38single slashes three single slashes or you can say three double slashes and don't use combinations
- 57:45okay either double quotations or single quotations sorry this is the one this is also commented so
- 57:52python will ignore this statement at the run time okay python will ignore the statement and
- 57:57this will also ignore let's try to execute so you will get the output only from the statement
- 58:05okay so this is how we need to work with the commands the first thing and then python
- 58:13will ignore the commands in runtime simple user just to improve the readability of the
- 58:17code we use the commands and then what are the different keywords available in python keywords
- 58:24what are the what is the meaning of keyword so keyword is nothing but a reserved word result
- 58:33okay result words in python what does it mean these words are having their own meaning in
- 58:40python so we should not use those fours for variable names or some other purpose
- 58:45okay keywords are nothing but a reserved verse and those words having their own meaning
- 58:50in python so let us see what are the different keywords are available in python there are so
- 58:55many keywords are there but if you want to display all the keywords in the list
- 58:59we can just write a simple code let me just go to the pie chart and i'll create one more program
- 59:06right click a new file and name it as keywords dot py
- 59:13and you can give any name to the file there is no naming convention nothing you can give alphabets
- 59:18lowercase character anything underscore spaces anything it is allowed now inside this i want to
- 59:24see what are the keywords are available in python 3 what are the list of keywords keywords are in
- 59:30the sense those keywords are reservoirs we should not use those keywords as a variable names or
- 59:35any other purposes but we need to know what are the keywords are available so simply we can just
- 59:41say print there is a predefined module in python that is called i'll talk about this modules later
- 59:48okay for now just understand keyword is a default module which we already have in python
- 59:54it is just like a package in java if you know already about java you know about packages right
- 59:58here we can call it as a model so keyword dot inside this we have something called a kw list
- 1:00:05we say again class actually so this will give you all the keywords which are available in python
- 1:00:12so as soon as you are using this name it is imported that class actually this class is
- 1:00:18present inside the keyword model and don't confuse what is class and what is module all these things
- 1:00:23so later on i will cover all these concepts slowly one by one so once you start learning
- 1:00:28object oriented programming concepts then you will understand what exactly this is okay just follow
- 1:00:33blindly what i'm just typing here and to access this kw list from the keyword we need to first
- 1:00:39import that keyword and then we can access kw list so what this will give you this will print all the
- 1:00:46keywords which are already available in python so let's try to execute run keywords now we can
- 1:00:52just look at this there are so many keywords are there and i'm copying them and try to print here
- 1:01:01there are so many keywords are there i'll put in multiple lines
- 1:01:10and scroll down you can see i have selected
- 1:01:12till here only so there are so many other keywords also there
- 1:01:20okay so i just copying them
- 1:01:38all right again so i'm just trying to put a comment
- 1:01:48okay still i have not copied all the stuff but these are the
- 1:01:51different keywords you can just look at this false none okay and as asset as sync await break class
- 1:01:59so these are the python reserved words or python keywords so we should not use this keyword for any
- 1:02:06other purposes because these keywords are having their own meaning in python so if you want to see
- 1:02:11all the keywords which are available in python we can just print this keyword dot kw list so
- 1:02:16that will print you all the keywords which are available in python so this will print prints all
- 1:02:25available available keywords in python okay so this is a simple understanding
- 1:02:35what is keyword so keyword is a reserved word which we cannot use it for any other purposes
- 1:02:41and the next most important thing is a data types every programming language
- 1:02:46is having some data types just like that even python is also having some data types
- 1:02:52like data types operators everything is there but something different here i'll tell you
- 1:02:59so what is the data type first of all so what is the data type suppose if you create a variable
- 1:03:06let's say x equal 100 what is x what is 100 100 is a value x is called a variable
- 1:03:12so x is a variable variable means what variable is a container which can hold some data
- 1:03:18so variable means is a container which can hold some data right and which will uh the python will
- 1:03:24allocate some memory to this variable and then we can store some data that's basically called
- 1:03:28as a variable so in python while defining the variables we have to know few important things
- 1:03:36what are those important things a variable is nothing but a reserved memory location to store
- 1:03:42the values as soon as you create a variable like this which will automatically assign some memory
- 1:03:47to this variable to store the value so variables are used to store the data and memory allocated
- 1:03:53when the values are stored in the variables as soon as you store some value into the variable the
- 1:03:57memory automatically will be allocated and every variable must have some type so what is this type
- 1:04:04type is nothing but a data type so every variable must have some type but in java if you create
- 1:04:12a variable we must specify the data type for example if i want to store a number in a variable
- 1:04:18we have to define that variable as an end suppose suppose if you want to store a string like this i
- 1:04:25want to store a string data into the variable that variable should be defined as a string
- 1:04:29type like this and this is basically called as a data type but in python data types are available
- 1:04:38but the thing is we here we no need to specify the data type so because python is having one
- 1:04:44very good feature which is dynamically typed language python is a dynamically typed language
- 1:04:51there's an another new feature which is having in python which is not there any in any other
- 1:04:56programming languages so what is the meaning of dynamically typed language as soon as you created
- 1:05:03a variable if i put some value by default this variable will be considered as an integer variable
- 1:05:11so you no need to write the data type similarly when you create another variable with some
- 1:05:16string value by default python will consider this variable as a string variable and you don't need
- 1:05:23to specifically say the data type but in java it is not like that so python is a dynamically typed
- 1:05:31programming language we have to remember this feature dynamically typed programming language
- 1:05:39and this feature is there only in the python programming language okay remember that so what is
- 1:05:44meant by dynamically typed programming language we no need to specify the data type of the variable
- 1:05:50but still data types are there in python what are the data types are there in python in the
- 1:05:54python various data types are there texture type str is the data type for numeric intender float is
- 1:06:01a data type if you want to store a single number integer then indeed is a data type and if you want
- 1:06:06to store a decimal number then float is a data type and similarly we have a list type a tuple
- 1:06:11dictionary a set bool these are different types are available in the coming session i will discuss
- 1:06:16more on this but remember like other programming languages python is also having the data types
- 1:06:24but it is not mandatory to specify the data type in front of the variable not required
- 1:06:30because dynamically the python will automatically assign the particular data type to that variable
- 1:06:35based on the value we provided okay that's a one very good feature which we have in python
- 1:06:42and one more thing is there what is that suppose x equal to 100 we put so x is a number
- 1:06:49right integer now after that in the x also i can put some different numbers suppose i can say
- 1:06:56uh i can also put some string value this is also allowed in python see initially x is a number
- 1:07:03but as soon as you change the value of the x automatically the x will becomes the string
- 1:07:08x will becomes a string so this is also part of the dynamically typed programming language
- 1:07:14but in java it is not possible if you define this variable x as an integer throughout the
- 1:07:20programming in x we should store only numbers we cannot store any other type of data in the x
- 1:07:26but in the python we can anytime we can change the value accordingly the data data type of the
- 1:07:32variable also automatically changes so this is a exact feature which we can call it as a
- 1:07:38dynamically typed programming language remember guys okay very very important feature from python
- 1:07:45so later on i will discuss all the data types like list tuple dictionary set all these things and
- 1:07:52if you store a string in a variable that will automatically consider the str data type if you
- 1:07:58store a number into the variable that variable is considered as integer type suppose if this
- 1:08:03number is having some decimal point that will be considered as a float type and if that variable is
- 1:08:09having only true or false that will be considered as a boolean type and rest of them are exactly
- 1:08:15used for the collections like in array in java we have arrays concept arraylist concept right so set
- 1:08:22like this so similarly python is also having some collection type right so this is our main feature
- 1:08:28which we have in python so now i'll show you one example how we need to work with this data types
- 1:08:34go back to the pi champ and i will create another file new file and i'll name it as data types
- 1:08:46dot py okay so now here let me just create some variables i will say x equal to 100
- 1:08:54so now what is the type of x what is the type of x in t is a type of x but how we will know the type
- 1:09:01if you want to know what is the type of x and what is the type python is assigned to this variable
- 1:09:07so if you want to know that we can simply know that how we can know that we have a function in
- 1:09:11the python called the type in that we can just pass the variable that will automatically gives
- 1:09:19you the type of x but we want to print that value right for that we have to use one more
- 1:09:25function called print function because whatever you keep in the print function that will print
- 1:09:30that as an output in the console window so type of x will give you the type of x what is the type of
- 1:09:38x and if you want to print that additionally we have to use a print method okay now just execute
- 1:09:44this and see what will happen so this will give you inter so this is belongs to integ class type
- 1:09:52okay so this is given in perfectly fine suppose i create one more variable y i
- 1:09:58have some decimal number now i want to know the type of i so what could be the type of y
- 1:10:04so this time i'm just writing the y now what is the type of y it should be float it should be
- 1:10:12float so double we don't have here okay only float we have so when i execute this which will give you
- 1:10:18float you can have it number any big number size is fine so this is given float
- 1:10:26now observe this carefully this time i am saying x y and yes equal to i say welcome
- 1:10:34now one more flexibility here is in python if you want to represent a string right
- 1:10:41we have to keep in the double quotations or single quotations also allowed this is also perfectly
- 1:10:47fine single quotations also allowed but what about the characters characters also you can keep in the
- 1:10:54single quotations or double quotations because for single character or multiple characters
- 1:10:59for both str is a data type for both str is a data type but in java it is not like that in java cad
- 1:11:07data type is different string type is different care we will include in the single quotations
- 1:11:12string we will include in the double quotations but here we don't have that kind of thing so
- 1:11:17we can just directly specify the string in the single quotation or double quotations
- 1:11:22similarly character also we can keep in the single quotations or in the double quotations
- 1:11:27anything is fine so this is a character but still i can give a double quotations
- 1:11:33okay anything is correct so this one is right and this one is also correct and
- 1:11:40here single quotation this is also correct and this is also correct sorry
- 1:11:51okay so this is also right and strings we can include either in single quotations or
- 1:11:57double quotations even single character also we can include in the double quotations or
- 1:12:02single quotation anything is fine okay so i just commenting this later on you can understand
- 1:12:09now i want to print i want to know the type of s and c also so let me just print the
- 1:12:15type so what is the type of yes and also i want to print the type of c so for s and
- 1:12:23c for both the type is str only now let us run this data types now you can see
- 1:12:30for string and single character also the type is str so this returns sdr means string
- 1:12:40okay so suppose i have one more variable called b and i'll say true so true means it should be
- 1:12:49upper case character remember guys so boolean value so what is a boolean type means either
- 1:12:54it allows only true or false so here i have ascent true here now what is the type of b
- 1:13:00i say print type of b i just print a type of sorry lowercase characters print type of b
- 1:13:11so this should be bull type boolean is nothing but a boolean type
- 1:13:18okay so like this python will automatically assign the data type to the variables
- 1:13:23based on the value we provided so we have seen that point now the dynamically typed
- 1:13:29programming languages we have seen one point here what is that one point we no
- 1:13:33need to specify the data type of the variable but based on the value we have assigned automatically
- 1:13:38the data type will be given to that variable by python itself and one more point is there in the
- 1:13:44dynamically typed programming language what is that point if you have some value in the variable
- 1:13:49and later on i can change that value some other type of value also you can keep
- 1:13:54suppose if i just look at here s equal to welcome what is the type of this variable string right
- 1:14:00and later on in yes i can store some number also this is also valid so what is the type of es now
- 1:14:09so let me show you like this see here uh take some other variable okay so for example
- 1:14:18some x equal to i x equal to i say one two three four so now let's type the print the type of x
- 1:14:26okay print type of x so what is the type of x here what is the type of x we are expecting int
- 1:14:34right so let's try to execute so type of x is in perfectly fine so after that i want to change
- 1:14:41x value to different so this again different type value so now what is the type of x what
- 1:14:48could be the type of x it should be string so now it should be str means it is a string
- 1:14:55so what we have understood based on that so if you have some value in the variable by default
- 1:15:00python will assign the data type but later on if you change the different type or if
- 1:15:05you add some different type of data again the variable data type automatically will change
- 1:15:11so that is also part of the this feature dynamically typed programming language but in
- 1:15:17java we don't have this flexibility there if you create a variable with one data type that is fixed
- 1:15:23we cannot change the data type of the variable we cannot change the value of the variable
- 1:15:30clear everyone so far so how to work with the variables and data types most important concept
- 1:15:38for variables i will show you one more example so are you guys clear on data types
- 1:15:42so that's the most important point here we no need to specify the data type for the variables
- 1:15:47and python will automatically assign the data types based on the values we provided [Music]
- 1:15:56all right now so let us discuss more on the variables so we have just to talk about the
- 1:16:03data types now let us discuss more on the variables let's create one more example
- 1:16:10go back to the pi champ and i will share all this code later okay i'll
- 1:16:15upload everything in the google drive you can get it from there
- 1:16:18so now let me just create a new file i'll name it as variables.py
- 1:16:26now let us see variables very very important concept
- 1:16:31let us say a equal to 10 a is a variable or not a is a variable which contains a 10 is a value
- 1:16:39b is a 20. so a is a 10 the b is 20 s equal to i store some string is it correct or not s equal to
- 1:16:49welcome is correct or not correct because strings we can include in the double quotations or single
- 1:16:54quotations perfectly fine now if you want to print the type of a b s a b yes then how what you can do
- 1:17:03print off type of a this will give you type of a similarly if you want to get the type
- 1:17:11of b i can say b if you want to get the type of s we can get the yes so when i run this
- 1:17:17so first one is integer second one is also integer third one is also integer so we have understood
- 1:17:22what exactly it is so we will get the type of the variables now let me just comment this statement
- 1:17:31example one let me write some comment here example one
- 1:17:40this you need to understand here i creating a equal to 10 okay and b is equal to 10.5 decimal
- 1:17:49number i'll say print a and a print b i say print a and print b so what is an output you will get a
- 1:17:59value is a 10 b value is equal to 10.5 so whenever i execute this code you get 10 n 10.5 perfectly
- 1:18:05fine now i want to print a 10 a value and b value both but i don't want to write two statements
- 1:18:14so instead of writing two statements for everybody suppose you have a five variables or ten variables
- 1:18:18you have to create five or ten statements like this to print the values of those variables
- 1:18:24so instead of that i want to have only one single statement that should be able to print the values
- 1:18:29of all the variables so is it possible in python or not yes so we can happily print the values of
- 1:18:37all the variables within single statement by using single statement instead of writing two statements
- 1:18:42let me comment these two statements and just writing a single statement print a comma b
- 1:18:48simple a comma b so like this you can separate or you can put all the variables by separating comma
- 1:18:55let me just execute which will also give the same result 10 is
- 1:18:58the value of the first variable 10.5 is the value of the second variable b
- 1:19:03a and b right so suppose here observe this i'm also commenting this code
- 1:19:13now look at this
- 1:19:20example two
- 1:19:25i just copied the same above code whatever i have so i say a equal to 10 b equal to 10.5 okay
- 1:19:33so here i'm defining multiple variables right so for example let's say a equal to 10 b equal to 20
- 1:19:40c equal to 30 so three variables i have created or let us say c equal to string value i have
- 1:19:48string value i have so three variables i have a b and c three different variables i created
- 1:19:56so can i create all the variables in single line so instead of a equal to 10 b equal to 20
- 1:20:03so instead of creating multiple variables in the multiple lines
- 1:20:06can we create in the single line just like above example instead of printing the variables
- 1:20:11in multiple lines like print a print b and c like this i have just used only one statement similarly
- 1:20:18instead of defining multiple variables like this can i create all these things in one single line
- 1:20:25yes we can do this in single line but how we can do that simply you can say
- 1:20:30a comma b comma c equal to 10 comma 20 comma and string value that's it so now what happens
- 1:20:40in the single statement 10 will be assigned to the a 20 will be assigned to the b welcome will
- 1:20:46be assigned to the c so instead of writing three different variables here also we have
- 1:20:52written three variables but within a single line we have done so now we can just print abc values
- 1:20:59see how much easy it is people who already know java you people definitely feel this very very
- 1:21:05simpler than java so instead of writing three different statement you can just write a single
- 1:21:09statement a b comma b comma is equal to 10 comma 20 comma welcome at this time of printing also
- 1:21:14we can just print a comma b comma c now when i run this you will get us values like this
- 1:21:21okay so in the in this example we have seen how to write a single print statement to print the values
- 1:21:26of all the variables in the example two we have seen how to write a single statement to define
- 1:21:33the multiple variables instead of writing multiple statements for multiple variables
- 1:21:37we have just created only one single statement which contains a multiple variables
- 1:21:43in example 2 now we'll see one more example example 3 i will also comment this [Music]
- 1:21:52see this i want to store a equal to let's say uh 100 right b equal to 100 c equal to also 100
- 1:22:04now how many variables we created three variables but values are same
- 1:22:09so if if the values are same right 100 is there for a value is 100 b value is 100 c values hundred
- 1:22:15so if the values are same for multiple variables the values are same for multiple variables
- 1:22:23instead of writing three statements you can simply write a equal to b equal to c equal to 100 single
- 1:22:30statement this is also perfectly right now what happens 100 will be assigned to the c
- 1:22:35same value will be assigned to the b same value again assigned to the a
- 1:22:39now a b c all three variable values are 100 only but when you have to use this statement like this
- 1:22:45if the values are same for all the variables then we have to use this statement like this
- 1:22:51now let us print a comma b comma c and then execute and see you got same values
- 1:23:02this is one more example one more scenario
- 1:23:06right so now i'll show you one more scenario let me just comment this example four
- 1:23:15example four
- 1:23:19understand this x equal to y x equal to 1 and y equal to 2 i put x 1 y 2. so two variables
- 1:23:26i have defined so we already know this i say print x comma y what is an output you will get
- 1:23:33when i say x comma y what is an output you will get x is 1 y is 2 so when i execute this
- 1:23:38you will say 1 comma 2 perfectly fine so this is returning 1 comma 2 right suppose i say like this
- 1:23:49printer y comma x i said so this will also print the same thing but the values will be interchanged
- 1:23:57right so 2 comma 1 is printed so this is also expected 2 comma 1 because the y values are 2
- 1:24:03y x values of 1 but here my requirement is i want to exchange the values between x and y
- 1:24:11but not exchanging the variables so i want to have the same order x comma
- 1:24:16y but uh instead of x value printing 1 it should print 2 and y value should becomes
- 1:24:221 that means i just want to do the swapping part swapping swapping of these two numbers
- 1:24:28but if you want to write this swapping technique in java we can write many ways but here
- 1:24:33it's very very simple with single statement we can do that so i want to interchange these
- 1:24:39values x into y and y into x so if you just print x comma y values you will just print to 1 comma 2
- 1:24:45but how we can exchange it you can just interchange this values you can simply say
- 1:24:50y comma x equal to x comma y that's it y comma x equal to x comma y then what happens
- 1:24:58so what is the current value of x 1 that 1 will be assigned to the first variable called y
- 1:25:04now what is the value of y here 2 the 2 will be assigned to the x
- 1:25:09now after that again try to print the x and y values and then you see the output see this first
- 1:25:15time it is giving 1 2 second time it is giving 2 1 so swapping is happened within single statement
- 1:25:22we have not written any logic here just y comma x equal to x comma y that's it swapping is done
- 1:25:30right so this is a another example we can also assign the values like this
- 1:25:38okay and same thing one more example we already discussed
- 1:25:42this in one variable we can store different values also right so i'll say e equal to 100
- 1:25:48now if you want to print a which will give you 100 right so which will give you 100 perfectly fine
- 1:25:56and suppose i want to change the value of a now we i'll put some string data like this now if
- 1:26:02you want to print ea what's the output you will get what is an output you will get here because
- 1:26:07earlier the a value is 100 so 100 is printed here after that i am changing a value equal to welcome
- 1:26:13so the latest value of a is welcome should get so now when i execute so we'll get the welcome
- 1:26:21because in pi uh in python we can change the value of the variable anytime
- 1:26:29again so that is again feature of dynamically typed programming language
- 1:26:34so this is the very most important term in python lives so if you go for python interview the first
- 1:26:40question they will ask you is what is the main feature of python so you have to tell dynamically
- 1:26:46typed programming language then they will ask what is dynamically typed programming language
- 1:26:51you have to tell two reasons one is data type you don't need to specify based on the type of
- 1:26:56data it will automatically second thing is the variable can have any type of data so once you
- 1:27:03specify one data once you add some type of data later on you can change the data also
- 1:27:08anything it can be string number float whatever it is so that's a dynamically programming language
- 1:27:16okay so this is all about the variables concept guys so today we have learned how to
- 1:27:25work with the comments what are the different comments right single line multiline and we
- 1:27:30have seen what are the different keywords are in their python and we have understood what is the
- 1:27:34what are the variables and data types and in the later one i will discuss
- 1:27:39more about this data because each register will take one session so they are very huge
- 1:27:43concept okay these are the fundamentals of python programming language which we need to understand
- 1:27:50okay so that's all for today's session guys i'm just stopping here so i will share these
- 1:27:55uh files so as part of today's session what you have to do is as part of your practice first try
- 1:28:01to install python and go through the document and try to install python and if you follow the same
- 1:28:07steps you will not get any issues okay it will go very smoothly and then try to install the pie jump
- 1:28:14pie jump is most important because we are going to use python pie champ every day and once you
- 1:28:20create your pycharm and launch the python and try to create a new project i have just i have shown
- 1:28:27you in the video so create a new python project and then create a new folders like this and try
- 1:28:33to create your programs and try to execute them so this will give you the basic understanding how
- 1:28:40exactly we have to write a program and how to execute how to execute your python program and
- 1:28:44so on okay so in the next session we will see a few more important concept from python all right
About this transcript
This page contains the full transcript of Session 1- Python Programming for Selenium by SDET- QA, generated from the public captions YouTube serves with the video. The transcript has 14,843 words across 841 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.