Transcript for:
Python Basics Overview

[music] Hi everyone I am your Shraddha didi and Today we bring you have read something like python's and you Are you looking to learn Python or are you looking for a Students who are into programming from the beginning If you are going to do this then this video is for you after watching this video if you If you want, you can prepare for college placements can do computing coding can do web Using frameworks like Jungo in development you can learn about it or else artificial Intelligence like Machine Learning Data Science You can learn things by watching this video For this we only need two things The first is a laptop and the second is a lot of Let the excitement begin Brand New Of course pythonanywhere.com If you have made it then whatever machine you have, you can see below Time stamps are given there, go there You can see which one suits you best Installation is required first Let's begin our Windows installation that is inside the windows Visit a website called python.org We have provided the link to the website in the notes below. It is also given inside and you will see it on the screen If you are seeing it then go to downloads and will download python3.7 After this, we will copy this file to our folder. We will open it inside and once again we will see the exe file Click on it and install it Now the software that we Click on execute and then Our installation will be completed by our You will have options to choose which language to choose Which folder do we want to select we want to make it the default where our python-pip start writing full code will now output anything inside python to get anything printed for that we have to write print and then After that, we write the whole thing Statement now here these above lines These are the comments that are highlighted are not part of the code and below what we have print is written this is a function function It is the part of the code that performs an operation for us or does some work for us then we used parens functions Python is always written with parens In and inside it we have written that which If we want to get it printed then get it printed it is hello world so it is written now hello We have written the world in double quotes. So whatever text there is inside Python we can write it in codes if we want You can also write this hello world in single code could but since I am not using java c++ I am from a background so my habit is that I double quote the strings that are I write from and the characters that are there like a b c d i will put them in single quotes I write, that's why I prefer it Writing strings in double quotes now above Go and click on the green run button Once done, we will run our code. And below is the output for us. hello world and above us your python3.7 p0 now go up and type hello world place if we want to print hello codes We can do that too. We just need to write Print Halo codes we can run this also and if If you want to print something else then take a complete You can also print the full sentence that i know how to count in which 1 2 3 4 5 6 we You can also print the numbers and they Our output will appear on the screen. Now we will If you want you can save the whole Python code as a single You can also save it in a file To save, we will go to file and there But we will do Save As and then do as we wish Now we will give any name by default python's need to be saved from dpa So we will name our file first. pra d pwa and we have saved it And we have to add this new name in our ID. It is now visible beyond this In the tutorial I used Pi Cham. I have done this because on my system there is virtual machine Vijay is not able to run in the machine for long That is why whatever code is there in the further course The entire code of that thing has been written down Simply we have to write pi in the same way inside the scripter and just click on the run button You have to make any error or any mistake for us you won't be facing any problem macam-macam You have to install Cham now. After doing this, when we open it, we will Directly drag it to your put it inside applications folder and While opening we have to change the settings to default I have to keep it in that's why we are okay with everything We will keep doing it and finally for us Our pie cham open If yes then we have installed Pi Cham Now after this let's start our There is software, after opening it you will see something like this here A window will appear to us now In this we have different projects These projects can be created In which we put a lot of python files If you can, then first get a new one for yourself. Let's make a project, I will write it here the name of the project so the name of the project we we give our college and this The full path before the project name this is the path where our project or all of our projects all the files in our computer If it is being saved then whatever Python We will write the files inside our project All of them are being saved here at this location After that, from here we will You can choose the environment There is a little bit of an advanced topic about Newbies are just starting coding We will ignore it for now in the journey Let's do our base here It is an interpreter, we have taken Python now Python is already inside the computer The other versions used to exist but The latest one that we installed we have chosen it is possible that when you When you open your pie charm, all these things are inside it The options are not coming inside it directly You can create a new project If you do not have to make changes in the settings there is no problem with that here but we create it if we already have it One pythonanywhere.com our college whatever we named the project a The folder has been created at our location and There are different files inside this folder Now we can see inside this folder We need to create a python file, so we What will you do? Right click on New we will go and find out that we need to create a python file We have to create this python file, its name is we can keep anything suppose we keep is first you would have named the program first program A python file has been created here And here this file has opened where But we can write our code now pay attention will give that the name of the file is first Pvt. python.py like if we have Inside Microsoft's we txcindia.gov.in is from java There are some extensions of the method here: Some files of the virtual environment are our If the passes are stored then we can see them from here that if we have a lot of files in python If the files are created then which file after that which file do I have to go to and which file do I not have to go to According to this we are working on the same file So click this minus button here. and then hide it so now we focus will do it only on your python file All the programs are in Python Here we will be writing it a little So let's make it bigger text wise now We are going to write our If you are coding in python-pip then You are doing something inside the program but the output of that program will be How will it be visible to us, we will see it now Learners are going to write to us for output we will put parens after print So we call these brackets parens. We can print anything inside them. Whatever we want to print from the program Now here we are going to print it. hello world and here is this double We have put quotes which represent What is a string when a string is any text character like a b c d EFGH @ rate hash or else 1 2 3 4 we call them if you write it within double quotes then it text becomes text i.e. which can't change it, it will stay the same Now we want to print the string This small statement is enough The point is Java is a case sensitive language That means you cannot make this small p big p If you cannot, what will happen? A red line will appear. first and then error will come because of big p I don't exist at all, small talk is for you you can print things out now here This shows we have used parens what is printf is a function in python now what are the functions inside of that how can we make it use the way we will be learning them later right now So let's just learn that print is a There is a function in Java, whatever is inside it We need to get it printed on the screen inside and now what will you do with this The above code will run to run the There is a run option inside run, you can go to run Click on your first program Click and here in the output screen It has been printed and sent to us Hello The world now has lots of keyboard shortcuts like when you go on a run here This control shift r is the keyboard shortcut So all those people who are using Mac can use this Can be used separately for Windows If there is a shortcut then use it accordingly If you can, then in this way you will slowly You will also remember shortcuts more quickly Your code must be getting completed now we We are going to learn about variables in Python About us now By actually visiting pythonanywhere.com It will be stored in the computer's memory So the memory in which the data goes to the computer It is being stored, we should give it some name so that next time we know what to do The location where the data was stored What is the name? So we call this name a variable. There are variables inside Python i.e. variables Let us define the memory location where But our data is stored as Suppose we want to store a name, then the name For this we wrote down the variable We can name the variable ourselves name is name and inside the variable we store If you want to get a string then store it I will get your name done with this, suppose you you need to create another variable inside the variable edge you can't use a string Do you want to store any number? If you want to get it done then here we have store I have got the number now what can I do about this We can print the name now. To get this done, if we write it this way So let's take a look at what will be printed for us. If we look directly at the codes, If you get the name printed inside then it will be helpful for us That name will be printed directly variables will not be inside strings that Even if he goes, he doesn't value it it prints it as is here we will be writing name and run it, this time print what has happened that we have put value inside the name we used to store it in the same way we can print You can get it done with your name edge and come printed for us here Now this variable that we have created will also go to age are inside this once we give the value If yes, then after that we can change that value also You can do this by changing the name, if Do we have to do something else or change the edge If we have to do something else, then The values ​​will change and now the name and If the values ​​that will be printed are different then Accordingly, if a variable is created once So the values ​​inside it can also change Now let's talk about the four major types of variables I will be talking about Python in these The first thing we learned from this is that strings It happens that I have learnt that there is a number now This number that we saw here is an integer Let's say there is a number, if we have 24 here if we wanted to make the number 24.0 then the number would be written in this way In Python we call it floating number and This was our integer, now of a fourth type There are also variables in Python, they are called We say define boolean whether something is true or false then the bole Two types of values ​​can be stored inside can be either store True or store It is possible that the falls are near our age Accordingly, suppose we have written this We can write in 'adult is adult' True, now this is true but the red line came so Because Java is case sensitive and in True Actually t is capital so if we Things that will not be taken care of in the case We have to save our capital, we will make them smaller or if you capitalize the small one then There may be an error here except for true We could have written false as well if we were older If it is less than 18 then this is how we can buy bullion You can also define variables in Python Now the special thing about Python is that In Python you can define variables There is no need to tell in advance what this variable is This type of thing is going to happen without any Any variable with a defined type Now you can store any value in To define a variable you can use two or three You can also use strings in between you can use underscore then like this Too many names to define variables what are the rules they give you You will find it inside the notes below now Before moving on there is a small exercise which We will be giving you the best in exercise The first thing we need to do is to define a person. whose first name we take and then If we take the last name then we need to define two variables whose first name is going to be Tony The last name is going to be Stark after that Define a variable named edge In which we can store 51 years of age you must have been there after that this is going to happen a variable called genius so Tony Joe He is a genius so you can consider him a bullion type How would you be defining it with the help of He has to write us a code of three-four lines. This is the solution of this exercise given in the notes below, so first You have to try the exercise yourself After that, the next thing is to look at the solution which We will be learning that inside Python Taking input from the user What we have learned so far that if we want to print something in python So how do we print that on the screen? Let it be done, now we will learn how to take something if in input then how to take it from user For that we use an input named What does the function do? Input Any The value is input from the user so here But suppose we want to take input name what is your name here we wrote the question Mark now if you run this code then here But now we will input our name. Now we can input this name but this program stored it somewhere If you haven't done it then why to store it Let's create a variable inside the name I will get it stored, if you run it again Here now we will put this name in the next line. print inside so what happened here we input the name The program did that with the name of the variable got it stored inside and then we changed the name Once we got it printed, the name that we have put here I entered which was Tony, she was ours If it has been printed on the screen then something This is how we take input from the user Let's store it in a variable and Then to show it back to the user print it and it prints well To get this done we can write here Hello and you can put a plus sign in the middle So what will happen with this plus sign with hello This name string of ours is added will go and both of these will be printed together the whole joining process inside programming inside coding It is called concatenate, so this is also called Let's run once and here we have to run Please enter your name which is Tony then hello Tony our entire print is done Now here's another exercise that you can do Ask the user what is your super Hero name or you can ask Tony what is your superhero name then he is your Superhero name or your superhero version You will enter the name of the person and you will see that name in someone's name It needs to be stored in a variable and If you want to print on screen then it is small The solution of this exercise is also in the notes You will get the next topic which we will discuss That is the type conversion you will be talking about now This is why we need type conversion because whenever we If we input then all our The inputs are in a string format i.e. if we input the number If we input a floating value Lee Bullion got all of this input done In what format will things come to us In string format, suppose we have Someone's old age which is the age 2 years ago If you input it, it will be stored in an old age variable and write here will give your input function enter your old Now we have to take this old age into the new age I have to convert to the new age What will you do to help in old age We will do it and finally we will print it who likes our new age so what have we done Created old age variable and put input inside it I took my old age and put it in that old age We added 2 years extra to the age and The combination of these two is what we call New Age If you put it in then sum here also the plus key If it is taken in the form then we add this to will do it with our old age and her If you store it in New Age then it will be equal to What happened to the right value in the left She went away and then got New Age printed now whenever we are doing this thing Execute, suppose our old age was 20 So here we have a type error. What is the type error saying can only Concatenate string not int to string Meaning the string is connected to the string itself can concatenate i.e. these strings trying to concatenate with a string It is happening but it is getting numbers here But he took two as a number, but It has taken the oldies as a string now Don't send oldies as a string to us I passed the old age of 20 but he passed the age of 20 as a string took it means 20 something like this The way it's visualizing the code we want them to visualize this number in the form of so for that we type We will do the conversion for type conversion Let's use a function called int int represents integers so which are whole numbers which are complete numbers There is -1 All of these together which include decimals there is no point, all those are integers int If you will pass your old age then do it in this way what will be the output from this old age string convert to integer So if we write int here passed the oldj inside it and then ran the code If you run then you will pass your age The correct output will be printed for us now error will not come now it is not that only inti is the function to convert into zer if we Whatever valid values ​​you want, we can convert it to float or else we can can convert attr to string Along with this, by using the function we can You can also convert it to boolean There are four ways to value this too. We are talking about convergence in which the variable will be valid which variable we can either convert them to float can float i.e. where It is a decimal like if we have a number 18 in which the value is stored 18 Now we have what did we do with this number in float Once converted, let's see that What will be the output of this that we will get The output was 18.0, so the number was an integer Even that which did not have a decimal was converted into a decimal our code has converted it into This is how type conversions happen What we are going to do now in Python Let's write a small program so that we can You get an idea that inside Python how to write programs So we will write a code which will let us what will we do, we will calculate the sum of two If you get the sum of two numbers printed then the most First, let's create a variable You will get your first stored in the first You can enter the number here First numbers will create a variable in the same way within seconds it will write input enter Seconds number and now what will we do first in an even Now we will store the plus second The output will not be what we expect I am coming but let's see once that What do we need to change in this First of all, enter your first number. Suppose we enter two and then enter if you do second number three then what will happen to us It has been printed but nothing has been printed yet because we didn't print the sum So let's print the sum here again. runs from here it's printed 23 so this is two and 3 why the sum of 23 got printed because our The one who is first and ours who is second, these two Now these are strings, we have just typed them I have not converted it so it is here first is concatenated with second If it is added then three is added behind two To remove its concatenate we have to This needs to be converted to int first will be converted to int second will convert to int then sum will calculate it, run it one more time So you will pass in first or second we will pass three output came our five Like here we have written the program for sum that two numbers are input by the user then those how to write the sum of both, in the same way we Python can write many programs Now let's say from this print here First we had to print the sum is and here we would have written plus so in that case It is not getting printed directly An error occurs in case a string is converted to an int if you can't deal with it then this is the problem To get this printed as well needs to be converted to string form Then whatever we get is the correct print Now we will talk about a special topic in Python Now we'll talk about what strings are Before using the string, check your We define the string by name Tony must be storing it inside Stark now as soon as you type name dot If you do this then many things will happen for you appears on the screen as if for us done index count upper replace find So all these are called methods, that is, we Make a lot of changes inside the string If we can, we will tell you about these changes Now you will be reading the first change which we inside the string you can do that If we understand all the characters In case, that is, if capital is to be made then its A method exists for what we can do all you have to do is write after your string dot upper and then pansies now this Simply we have to get the print done After getting this done, our output will be all the characters are capital It must have been done now, this dot upper function This directly converts our string. it doesn't do like if we name it after that If you get it printed then it will be a normal print Meaning it returns a new string to us. I gave it in which capital letters are original the string is not touched just like that if we If you want to convert everything to lower then use lower If we write down all the characters are converted to lower case The next operation which we are talking about will take place We will do a find operation now a string Inside we can see anything, any character or any sub string means a small part of a string if If we want to search then we simply do it can write dot find so let's say Tony Inside Stark we have to search for capital s will be written here print name dot find inside it pass will do our capital s now to the strings In Python, to define double we can use You can also use quotes and single quotes can also use but since i have c+ and I am from java background so when I characters have to be defined which means Single A Single B Single C Single Dret To I use single codes and when Strings need to be defined like a word or a sentence or a whole part I use double quotes for paragraphs You can use any quote as per your wish. If you can, then here we are going to find gonna have this capital s in your name Now this find is related to a particular a character or a particular substring will search inside the string if it finds it So wherever it goes, at whichever index will get it, it will return its index and If not found, it will return -1 index What are indexes in Python is our position like if this name string If we talk about it, then it has zero eth position inside it t comes in first position o comes in first position Our n third comes in second position y comes in fourth position if there is space then whatever the indexes are In Python they start with row That means we do not start from position first Let's start from the zeroth position like this c++ is in P, same happens in Java It does happen, but there are many such languages ​​too where the index starts with one It does happen, but here we are talking about If you do zero indexing then put this code here If run then where does it find s Kia Index Five 0 1 2 3 4 5 Index Let's assume our capital s comes to five If we had to search for small s then in that case I would have returned -1 here because small s is not there in our string Apart from this we can also find any sub string For example, let's say we call Stark want to find that also starts our index from five but of star if we have s which is That small car in that case we have -1 print If it is happening then in this way we will get a lot of One has to pay attention to which case We search for whether it is a character or a string Now we are doing the next operation which we we will talk about that inside the string we You can pick up any part and can be replaced with any other part Like here if instead of Tony Stark Let us assume inside your string By removing the entire Tony Stark, he If he had to replace Iron Man then he How do we print the name Dr. replace whom do you want to replace Who does Tony Stark need to know about the whole thing? If you want to replace Iron Man then Run this now what will it print for us Iron Man is gone but it's the original string if does not change then we print The name will be back and our original name will be printed it will be known who is Tony Stark now Well, we now have Iron Man instead of Stark. If you want to get Tony Ion Man printed then click here If we remove Tony, we will remove Stark You must be replacing it with this term Now what Tony Ion printed for us I think we can replace it in some way like this can assisting all strings or even Entire string of characters we can also replace t if we replace m with moni here If the star is printed then the characters Can also replace find function now What did the find function do for us I used to bring the index and give it to any position any character or any substring It was available but we just had to check this that that substring or character exists whether it is there or not we do not see that it What is index and what do you do for it? For that we use one of these keywords What are keywords? Like any There is a dictionary inside the language which defines that these words are in this language Programming is part of the same The keywords of the languages ​​are Dictionary of Programming Languages there are parts like in english language Inside we know that apple is a word orange There is a word when we take input then input When we use this input, this is a The keyword is that along with that we use print if you do then this one print is also a keyword That's why it's highlighted in purple in our editor. The rest is happening to us by the variables themselves let's define it it's not highlighted it Simply you would be visible to us in white All the keywords are highlighted if we are writing a text The string you are writing is in green now here we want to find someone any character or substring in your inside the string then for that these function what will we use what will we print If you want to find capital t in name then It got printed for us, true, what is ours The capital t is a character in our name exists inside a string then that In case it is printed for us True But here we assume that we are trying to find m. If you want then it will print false A does not exist there if we search for it Whether a substring that is stark exists what does he do in his name then he will come for it Tru now goes to find Iron Man so he can If the false comes to us then it will be something like this By getting True False i.e. Boolean returned, we are You can also search for any string inside now next we're going to talk What are the erythema operators of erythematosus like in maths we have done a lot of You must have studied operations whenever we first There will be maths in second and third class We had to plus someone I used to use sign, I had to do minus We use the minus sign to divide two numbers if you wanted to multiply then you would have multiplied for all these operations which operators are used i.e. this science These are used, we call them operators Now here is the diff inside Python Operators will see these almost similar These are the ones we used the most in maths The first operator is our plus operator so we what will you do, let's print 5 + 2 So with the plus operator we get the sum then replace the plus if This is our subset used from minus For the action, 5 - 2 prints have been done is three similarly if we multiply If you have to do it then take the biggest risk here If we give you this est on our keyboard This is a sign of risk, this is a sign of a star Multiplication happens in programming So 5 * 2 is printed out to us if If you want to divide then put a slash So slash means divide rithm If we run this in operators also then our got printed 5 / 2 = 2.5 now for any Also when we multiply two numbers then either our result will be in decimal or our result could be an integer like here we can multiply 10 by two If you were dividing, the answer would have been five But if you divide five by two, The answer is coming 2.5, suppose something like this There are cases where we need to use the decimal point after the What will you do if you don't need numbers? To remove numbers after decimal places To take only integer values We're gonna double this slash up so two slashes when we apply or divide by two When we put the sign, then our decimal The part after that gets removed If I scored it based on the result then it is not 2.5 anymore It was printed, only two were printed, now its There is another operator as well In programming this also happens in Java c+ is also present in P and also in Python What does not usually occur in maths is Our reminder operator also calls this a module So they say that this is the sign of percentage Represents our reminder operator What does a reminder operator do? When numbers are divided, a number with the other whatever reminder remains If he returns it then we would have got it done Print a reminder of 5 divided by 2 One has come to us and along with it another operator which is the power operator then to raise a number to the power of another number what do we do in between two est Let's take a risk or put two stars If you give then put a star here for it means f 5 to the power 2 chch is 25 run this If you do, 25 will be printed for us. Now let's look at some shortcuts in Python There are things to calculate which The most we should know about is First, let us assume that we have a variable in which in the beginning we wrote phi now What did we do? We added two to five. And we have brought back the whole of this then whenever an expression like this This happens in Python by doing a mouse click That is, we can write this whole expression as We can write + = 2 so this first line and this second line is for both of them means the bean is inside python like this if If we want to minus then minus equals We can write to multiply by 2 So multiply equals to 2 so in this way We can perform a lot of operations By minimizing them, now inside Python, Operators make small talk operator of president president means if Suppose we are given an expression such that like 2 + 3 * 5 or else this expression The result can be 2 + 3 means 5 * 5 25 or then maybe 3 * 5 is calculated first as 15 If we add + to it then 17 is now which of these two Which one will be correct depends on Which is the first operator in Python? The president takes over, meaning which rule Which operator runs first? If the operation is performed then a board mass of There is a similar rule in maths The rule also exists inside Python now which Complete chart of operator presidents Which operator's president is above Which one will come, it will be given to you through the link below I am getting the complete defined chart We will discuss a little bit here We will discuss this in a little bit that Its multiply operator is president is hired as compared to plus operator so the result here is 17 So first it will be multiplied by 3f and then to be added to this If we suppose we have to add two first If it were so, I would have put brackets here If we had put brackets then the result would have been ours goes to 25 in the same way here if If there was a multiplication then the multiplication would also be with plus If it were there earlier, then after multiplying it we would have had 2.6 came so this is how the president We have different operators now and talk about small things This is the code with comments in Python The part that doesn't calculate anything also does not perform the operation means such Things we have to type on our screens but they should not be made part of the code Let us assume that in normal English We have to write them, we call them comments in Python How to write comments in let's say we wrote hash then with the hash All comments start with then in python we can write here is a comment so this is a normal english There is a line but there will be no error here. English why will we write that line because here We have made it common if we do this in the same line if you had written it down then what would have come here If an error occurs, we will use normal English and Python How can I write the comments form in Now what is the usual function of comments? now whenever we go to the organization go to big companies or go into startups or ever if If you are writing good code then your code At some point of time, anybody else Now that person must be reading it and will understand which of your longest codes You can know what the part performs Write a comment on each part Like we made a small program If we had to find the sum of two numbers Ours would have been the first comment in that Taking Input After taking input we If you take the input then first is equal to two We do some input and then our Whatever second comment is made, that would be it Calculate the sum in this way To define a program, we use We can now use comments in Python Comparison operators are to be read inside Comparison means comparing two things Compare which is bigger and which one It is now easier to do comparisons inside Python There are some operators for these operators What does Ballin return value do? That is, whichever operator you applied for its output will be true or false It depends on what condition you have If it is installed, then firstly we accept that We need to print that 3 is greater than 2 so is three greater than two yes If it happens then we will get its result true but let's just say 3 is less than that Two So this is the comparison operator of less lane In that case it will be returned to us False In the same way less than equals two is also false There is an operator, so in this also we have will come on falls if there is greater than here If you make it equal to then the result will be true for that now There is another comparison operator which compares two compares the values ​​so if we have We want to compare whether the value of three is two is equal to the value of then in that case the middle what should i write equal to equal to then This equal to equal to operator will check that whether two values ​​are equal or not is run If you do this then the output will be false but here If you write three instead of two, then in that case We will get the result as true now equal two equals two we have checked one not There is also an operator called equal to NOT To do equal to, you simply need to add one remove the equal to and put a new one at the beginning Putting an exclamation mark is an exclamation mark That means now those students who have You must have studied logic gates or college Some subjects named DCS are going on inside Inside that we find out that Any value gets reversed by applying So even inside Python, whenever we If you put an exclamation or note then every The thing gets reversed from true to false becomes false of true then if We have to compare two values ​​so 3 no The output we get from Equation 3 is If we write false and two, then Its output will be true i.e. two values ​​when It is equal and in between comes not equal to So its output is false, which means you are saying wrong. But if the two values ​​are not equal and If there is not equal in the middle then its output is True will come now the next operators we The one who is going to study, his name is Logical There are three types of operators in Python: There are logical operators, the first one is What does our AU operator do if Give this operator two conditions, suppose If one condition is true, then another condition is false what will this do if either of them will be true if at least one is true then will get it printed true otherwise both will be printed If there are false ones then he will get them printed If we want to get it printed here 2 greater than 3 and 2 is greater than 1 so here but 2 is greater than 3 will return false and 2 If I am greater than you then it will return true The final output which is returned to us It will be true that it will come now and apart from this there is one more operator is the end operator and What does the operator do? Both conditions are true Only then will true print be done, rest all will be done If it will print false in cases like Print 3 is greater than 2 and 2 is greater than one so in this case we have it printing It will be true but if we do any research here Reverse the condition, meaning even one of them falls If you make it then it will print false for us The third logical operator in Python is is NOT operator what does the NOT operator do turns true into false turns false into true It makes it like if we get it printed Even if 2 is greater than 3 then 2 is greater than 3 The output should be false But if we put a NOT in front of it then its output will be true if its reverse If you do that then that thing is also possible like true The reverse of is coming to us because of not hoga false now let's talk FL What are FL statements of statements happens in programming whenever we have to Conditions have to apply that if these If the thing is there then this work should be done, otherwise this work Let it happen like this when situations arise we have that if the sun is rising then we Get it printed if the day sun is setting After that we will get it printed so that the night is like this which are conditional statements We use these in programming A colon has to be put, so here we put a colon to show that we are a Write a block of sentences or statements now are going to be a block of statements i.e. a We are offering a pack of combined statements If you are going to write, then we will get it printed here will give you are an adult and in the next line We will get it printed, you can vote which coder c+ Coming from a background of Python and Java Block of codes for them is here Curly If it was in the form of braces then here The opening curly brace used to look like this closing curly brace but in Python's We don't put braces inside block of code Here we do the indentation for Indentation means giving proper space here How to indent a tab We give a space of four spaces for this colon after so this tells us that both of them The line is part of if this if and after this Suppose if we wrote a line outside print thank you so this is thank you this is These two lines will be printed in every case then Will be printed when this condition is true So let's run it once. By clicking run My age was 19 if you checked that if our age is more than 18 then this If we print both the lines then our Both the lines got printed and thank you So it had to be printed now if the edge here If it was 16, in that case just say thank you would be printed because this statement which it falls now if we are just one We cannot put any conditions other than that You can apply all the if conditions then next we will apply the if condition l if lf i.e. else if the first condition is not true If it happens then you should check this other one means LF so inside LF we what if our age is less than 18 In that case if end edge is greater than 3 then What we need to do in that case is we need to print you want to get it done in school And whatever cases remain, I mean the rest We need prints for all the ages I want to get it done, you are a kid or you are a child Because how many cases are left? Those cases Jinam age less than or equal to 3 is now here But we wrote three key words, the first was if Second was LF, third is Else If Define does our starting condition l if k Inside we define starting If the condition is not true then you can check another one. If the second one is not true then check the third one. Now what does Elsa do above? If the conditions are not true then our else it gets executed in else if we If these two fell and we reached Once we reach here, get this printed for us So now here we can define any edge we can do that let's say we wrote down 13 So on that basis we got the message you are in school if we raised the edge to here so after that came you are a child so something like this The way we write FL statements Now here is what we do inside Python: we will make a mini project Using Python in the project we have just Using the concepts learned so far, a If we are building a calculator then To build the calculator first What we need to do is to choose our two operators. That means your user has to input two numbers to take the input of first number from Write enter first number After that what will you do with your operator input We will take it whether to plus or minus do you want to multiply or divide If you want to take the module then we can do only five operations If you are performing then inform your operator also take input what are the options in enter operator plus minus multiply divide and The models will then print their seconds number then input enter sec sec Now we will put the number on these operators if else condition that if is plus then first and The plus of the second is the minus which we will print So we call first and second subks will write fls in this way If operator equal to equal to plus in that case will print it Now this statement is called first plus second. let's copy it let's paste it here come here will our minus will come here multiply here our divide will come and here comes our model and at the end What we will do it here L now repeatedly writes F and repeatedly writes F what is the difference l means this one The condition will be checked only if it is false But if I write it here then all the All the conditions would be getting checked even if it is above was it false or true and one We can also write the else case in else case will write print invalid operation now one thing here If you notice then our first one and that These two are seconds, they are not numbers yet If both are strings then the first one Let's convert this into number form Let us run the code. After running it we Enter the first number to the second number Enter your operator before clicking enter Let's say we need to multiply by two With two, our output came out to be four. Let's execute it again, this time hum five trying to divide it into two The output came from 2.5 So this is how we made our mini I have built the calculator which is fine Whatever operation we do using conditions If he wants to perform, he should perform for us If you know Python, you will get it Laptop or calculator sometimes breaks down Your internet is down and no one needs a calculator There is no app that If there is a highly impractical situation then In which case you can create your own with Python You can make calculators and conduct exams etc. I can cheat or whatever now The next thing we're going to read is Range inside Python Range inside Python There is a range of numbers, the meaning of range happens from one value to another To get to the value, if in Python we wrote given range of five so that means we I want to write numbers here 0 1 2 3 And four to row to five, whatever They are all numbers, we define them here With the help of the range, we are just last in this The number is not included i.e. five If the range of five is not included Suppose we store the numbers into a variable named and then print it Are The numbers will give us the result Range of numbers from row to five in which If five is not included then this range Actually is a keyword and this is from Pensis We find that range is a function What does the range function do inside Python If you pass any number in it then You will get a list, a sequence of numbers. Now inside Python Next and very important concept What we're talking about is the loop. Let us understand the loop once we have we need to print one then print You have to do two and then you have to print three after that print four after that We have to print five now in this way we have I printed from one to five These values ​​will also come to us as output on the screen but we need to print one to 100 so should we do it again and again this print statement repeatedly you would not be writing at all because what is programming programming It is a game of smart people in which everyone To minimise all the hard work If somebody comes for it then Here also our work is to minimize for this a concept came up which we call First we will talk about loops inside Python karenge vile loop ki vile meaning in english unless you set some condition Give it as long as that condition is true Your work will continue as soon as the condition falls It will happen, if your work stops then what will we do Let's define a variable like this Let's change the variable to one with the value now Let's write vile this vile is a code inside python is the keyword and now we will write our condition when Till then our i is either less than or equals to 5 till then you can put our i Print it and here we will replace i with every we will update the bar i = i + 1 so here what's happening i am starting to one this while loop will run until Our i takes the equation 5, every time we add i and there will be an increment in it if you do then run this code it will print for us 1 2 3 4 5 how is this Previously the value of i was printed as one. If ours is less than five then one print will be Now because of this statement i has increased Even two is smaller than five, so is two All the things were printed in the same manner We have our numbers, they will be printed Now here at the top of the screen, if we did this If the update condition was not written then in that case What would happen to me? Same thing would get printed again and again Because the value of aa is always one and There comes a point after which our computer the memory gets full and then our the program crashes That's why these loops are inside which This condition is removed, they are called are infighting otherwise our code will crash now here If we write 100 instead of five, we get 100 till then all the numbers are printed You can get it done, if you write 10000 then it will go upto 10000 You can print out all the numbers and see How fast did you print our The entire Python code generated all of these numbers It is very fast to code in this way It happens, each one takes very little time in performing the operation and numbers up to 10000, these are the numbers If we had got it printed, many It would take time now besides if we had any like printing patterns etc. from our Questions come at the time of placement that the value here is equal to Print out the stars you have and paste it we do it Five so in this case some structure like this If it was printed for us, what would happen here? It means that the value of 'A' is equal to the number of stars. If it gets printed for us then here is the best First one star was printed, then two stars then three stars then four stars then five stars and this multiply is like It was a pity that our strings would get connected Multiply would work in the same way as it used to You can convert any number to a string If you multiply it then that string will be that much hee times will come to us in print Like if there was hello here, then there would be a Hello comes once, hello comes twice here Here's hello three times now that's for the stars If we want to print the pattern upside down then You don't have to do anything for him, just do it here is i = 5 Here you have to pay greater than equal to 0 Here we have to print star and + now instead of 1 we have to do -1 so that our The pattern is now printed upside down This is our triangle upside down on the screen If it has come, then in this way our vile Loops work python's for loops in python Usually we have a list with a structure Loop over it to do the it on top of it To apply we use for loop is used basically you have contains an object or a sequence numbers to pick up his items Like if we had defined a range which was From roe to fur we have everything in this range If we want to print all the numbers then what do we do We will do for a in range print a here All numbers that are within the range Once they are printed, what have we said here? what keyword is used for what keyword is used After that it is written that whatever item is ours we could have also written item here also let's write these keywords and then write range so All the items we have within our range All items are printed for us Now suppose we don't have to go from row to four If you had to get five prints done from that then here every you would get the item printed once plus this In this way all of them would have become plus one In items, from one to five, all All the numbers are printed for us So this is how our for loop works Now let's talk about Python inside Python So far we have listed the data types I have read that string float was included in it int boolean all these primitive data There are types, then there is a list Inside the data type list, we can find a lot of things that Primitive data types are those that store If you can then you can call it a list or collection of It contains items which are complicated like If we want to make a list, let's say If we want to store our marks then We will give the marks in the form of a list If you can store it then make a list so we have these square brackets which are You use your marks in this Let's store the English words first Marks then Chemistry Marks then This is how we calculated the marks for Physics marks are stored and after that If you want to get these marks printed then Let’s get the print done If we ran the marks code then for us All our marks are Once printed, this thing called Marx variable it's a list now it's not like that All the items inside the list are of the same type All the data is there, it is here If we want to store maths and If we run it, it will get printed for us as well Now if we find any individual To get the marks of the subject printed How to get it printed? We can get it printed We will get the square made in front of Marx By writing brackets, the square brackets Inside, whatever index marks we get If you want to get it printed we can get it printed Suppose we have to calculate the number of eigenvalues ​​at zero eth index If you want to get the marks printed then this is it The zero index is gone, this has become the one index If two index is done then those with zero index Marks will be printed for us which If you want to get this 95 first one printed then they will be which is 98 now usually other languages The index in is positive Here also we talked about which index is increasing in a manner 0 1 2 3 4 but The index in Python is It can also be negative, so here if If we wrote one, we could also write it as -1. -1 means or minus means Index in Python that is behind If you start counting then -1 means ours The last item is this we got printed 97 got printed for us in the same way If we had written -2 here, in that case for us 98 would get printed then minus means from behind We are starting to count, it comes to -1 It comes at -2 It comes at -3 now -4 If it is printed then in that case our list index will be out of range Because there is nothing behind this Now, if we assume that we have the last subject We don't need only first marks For the marks which have two indexes If needed, we can create a new list for that How can we create a new list You can write marks here, we will write them again from which starting index to which If you want list till ending index then We need a starting index for ourselves will be the row and ending index for us will go to so this ending index here if this is not included then 0 colon two This means that only 0 and one will be included. If it is not included then print it once If we get it done then the output will come for us 95 and 98 became 1 and 3 in the same way It means that we are taking one and also taking two If there are three then it will not be included but In that case, even zero will not be included 98 and 97 would have been printed now that this is what you have completed I have made a complete list of each and every item We can calculate each score by taking out one mark. can we put a loop on it which loop we will put it here we will put the for loop here then we will write for score in Marks Print Our Score then the score will be printed for us first 95 will be printed then 98 will be printed then 97 So one by one we will learn all the marks You can now access the scores This list that we have made is also on top of the list There are many operations that we perform like we did over the string We perform the same operations here will perform operations on the list So the first operation that we will talk about is That is append operation in English It means to add something to If we take marks of three subjects and we have to get marks in maths also We have to add it in this, we will write marks dot append and what will you pass inside it whatever If we have to add new marks then maths 99 If we want to add, we will add it After that, we print it once Now your marks are in our marks 99 whatever is at the end has been added or appended It is done, besides this we can also insert Let's say from append then we give the last are you able to add something in between us If you want to add something by going to any index then For that we use insert so Here we will remove the append and do the insert If we start with our maths If you want to enter marks then first enter the index You will have to write the index to start with our marks will be zero and 99 so this If you run then 99 will be the start off the list Which item exists in your list? Which element exists or not How can we check that as well we will check suppose we want to check that Our number 99 is now in our list whether they exist or not then it is for that will print 99 in marks so these what the keyword will do is it will check whether 99 If it exists within Marx then yes It exists, that's why it got printed on our so true if we search here 93 for that it would print false now one more We can perform operations based on marks We always get its length along with that How many elements are there in our list? what is its length so here if we print a and pass it inside Our marks are our marks list its full length should be printed for us will go, that means four will be printed for us If we remove the maths marks and print If it had to be done then in that case for us If 3 would have been printed then it would still be for marks Above we did it with the help of for loop If we want to do it with the help of a while loop then we If you can use the length then firstly a We will define the variable i = 0. Now we will write our vile loop vile our i is lace the difference is due to the length of marks till then we Marks will keep printing Off we will update i and i by one so in this What happened in the case with the help of vial loop our scores, our marks They are printed out for us one by one Now if we look at this entire list If you want to empty it then what will you do for it? operation will use marks dot clear with the help of clear if we after this Get your marks printed and leave a blank If the list is printed, what will it make clear? will empty the whole list so this We have read some operations on our list Now we are going to talk about break and Now take a break to continue and then continue Important keywords of our Python These keywords are also present in C++ and Java If it happens then let us understand it with an example what do these keywords mean the most First, let's make a list inside the list Names of some students are stored must be Ram Shyam Kishan Radha Radhika then this We have the names of some five students. We have stored it, now what is our job We should know the names of all these one by one. I want to get it printed and while getting it printed One thing we have to keep in mind is that as soon as Once Radha's name comes, we will have no other name Not getting print done means only from Ram Until Radha's name comes up If you want to get all the names printed then how do we do it for loop We get these students printed you will stay with your students but as soon as now Here we have the if statement inside the for loop If you are writing this then this is a new use case We must look carefully at whether our The name of the student should be equal to Radha had that case I will break this thing that means for means we have all We made fun of the students every time We are getting the students to print it but As soon as our student's name is Radha We'll take a break before it goes away break means breaking the loop and getting out of it exit means the loop ends after this then wherever we have to end the loop where it happens we use break keyword Let me give you a chance now if you run this then only Ram Shyam and Kishan will be printed Radha and The name after that is not printed. Now there would be another keyword besides this Continuing, suppose there was a case like this In which Kishan is from our class He was a student but what happened to him now Parents have been transferred to someone else in the state and now it has shifted so He has got his name struck off from school and his The name should no longer be printed in the list So now we have to know the name of everyone except Kishan. If you want to print then click here in condition we would have changed that if student is equal to is equal to question then in that case continue means our loop Run the current loop one more time If you don't do any work then you will run this Names of all other students should be printed Only one Kishan's name will not be printed If it happens then our work will continue in this manner Now inside Python it does this in the next We are going to talk about structure in Python in it's name is tapal now tapal is what It is just like a list That means once you have created a tuple you can You can't change it like inside a list We were able to insert things, we were able to append things if you were able to clear it then Method of addition, modifying or deletion operations is not inside our tuples, so if We need to define a tuple of marks So here we write marks is equal to Now we define the tuple of pens In the form like in the list we can use square We used to use brackets, now we use Store your pennies inside Marks You will score 95 marks for English 98 for chemistry 97 for physics now value Suppose if we have to calculate the marks of maths also Input or we are not 95 on row eth index If you want to keep it, then simply what will marks of row be equal to 99 we are getting an error here why will an error occur because the tuple Object does not support item assignment Because here we are trying to change our tuple. so this thing we don't can do So the tuples are our We will be talking about mutations the most The first operation is to count which object occurs how many times like 97 If we write it three times and here We want to get it printed and we want to count it how many times 97 comes then write it Marks dot count inside 97 If you want to count then you will pass 97 and Three printed for us now 95 Views How many times has he come so one print for that It happened like this if we get any number What if you want to see the index inside a tuple will print marks dot index Now we want to see the index of any number Suppose we want to see the index of 97 then If 97 comes three times then the first time when 97 its index will be printed for us So it will be printed for us on the row 95 is on one 98 is on top 97 for the first time in this The way our tuple works is next We will talk about structure in Python Its name is Set Now about sets We have also studied in maths what are sets used to be like if we got all the enough Elements that are a collection of stores It has to be done but only for the unique elements If you want to keep duplicates then do not keep them in that case we used to use sets in the same way are set inside python now like if If we want to make a tuple a set then for that We will just change these brackets here and Curly will bring it here braces so what have we learned so far that when occurs when square brackets appear OUR LIST WHEN THE PENNS COME our tuple and when the curly braces come in then what happens to us is our set in this manner Inside tuples of differentiable things it Wearing pennies is not compulsory, that is, if you will write person i equal to ram comma shyam comma now this structure which will be formed is by The default will be a tuple, get this printed If the person is coming printed for us there will be a tuple so this parens is They are not compulsory, they are optional but The code is good so that the reader knows that What we tried to print what have you tried to use so If we use parens then here We have defined the set, now we can define the set our 97 inside is three times but If we get our marks printed then 97 will be printed only once will be printed because inside the set The second thing that stores a unique value is if We are here to get Marks of Zero printed if you try it you will get an error Error will occur because inside the marks Index does not exist within sets That is, which value is on which index you have no idea if its If you want to mate the above item then you just run a loop You cannot access with index We can remove these values ​​and Now let's run this one for us one by one By doing this all our scores will be printed. Now inside our sins sets we have There are no indexes so it can be used There must be an order and a sequence of things But it has an index If there is no index within the orders to him There is another structure similar to orders In Python it is called dictionary Dictionary is a very important structure We store key value pairs inside the dictionary Like if we need a single student If information needs to be stored then it must either will we do it in a tuple, will we do it in a set or will do it in the list but with the student Always have information about his/her parents Need more values ​​in two pairs When information is stored, it is stored in the dictionary as if this If we convert marks into dictionary If you want to do it then we can do it in this way First we will convert the curly braces We will put it on and then write it is ours or it is ours English and then you will put your colon again will store the marks of english 95 comma Then we will store the marks of chemistry colon 98 so in this way we first do our Whatever it is, we have kept it as our subject The value we have kept in our marks, if we are parents Storing student information So we made a dictionary called Information First of all Ram would have taken it who is the student Suppose the name of the father is Balkishan is a student parent in this way Now if we could store the information If you want to access any information how to access it let's say print If you want to check your chemistry marks then Write print marks here of chemistry so in the first index which We used to write numbers, now instead of that number we If you can write it in full here We have passed the age index in chemistry diya and marks of chemistry for us will be printed which is 98 now if we If you want to add any new marks then how to do that Add marks here you can write them now After that we have to print the marks of Physics If you want to get it done then first add marks of Physics Let's do 97 now what will we print We will get your marks done here English also came here, Chemistry also came here And now physics has also come here We can also change the assisting marks There are marks in the dictionary i.e. Physics marks If we want to make it 99 instead of 97 then what will you do in marks of physics ect 99 and after that you will get yours printed Marks so here this is the Physics we have this marks in the second line It will be printed after changes, let's talk now has functions like we have a TV If there is a remote then there is a different By pressing different buttons, different things like the volume buttons are there If we keep pressing plus plus then The volume will increase when you press minus If you go, the volume will keep decreasing Each button is performing a different operation There is a difference inside Python's code like this There are different parts of every program One part performs one operation and If this part is for a specific operation If it performs then we call it a function If we give it then now there would be three types of functions are the first ones inside python Our inbuilt functions are different our modules are functions and third Our user defined functions, i.e. whatever the user defines what we will be writing now Even if we don't want the inbuilt functions Even if you want you have already read it inbuilt function i.e. like we read int in our type conversion or to ATR did you read it or did you read your bull which there are functions, these are ours Inbuilt functions that are already built in Python they exist and we directly Let's use other types of functions Our module functions are now Java's what is the modus inside when related Putting functions and related variables in the same file That file is stored in Naming modules in Python is now quite common All modules exist for Python We can use them directly inside. And we can get our work done through their functions. An example of such a module is Our math module so use the math module To do this we need to write in our code Does matter Import Math Now inside the Math module we have a lot of All the functions are already written How can I print these functions? r of math so as soon as we di r of math this Write the lines and get them printed in the same way All these functions are performed by the screen for us. But all our maths are getting printed The functions of the module are now any one of these If we pick a particular function then the value So we've picked up the square root now. If we just had this square root function We don't need the rest of the modules if so then for that we can do from math import a function and these are functions What does any number do to us? returns the square root so here If we print s of number 4 then that In our case the square root of 4 will print Which is 2.0, similarly write 4 in place of here give 16 then it will be printed as 4.0 in the same way We can also take specific functions from instead of taking the whole module Let's assume all the functions together If you want, we can make you a star here star means all of them select all then that In the case, all of them will come to us And we can use the square root directly Now you will find the third type of function In Python, they are our users. defined functions which the user, i.e. us Now programmers make it themselves What is syntax? Syntax means any I still don't know the correct way to write anything We were using the proper keywords, proper were using things were using space That was all the syntax of Python, now let's talk about functions The syntax of writing is that first you Write the definition After the definition we write is definition i.e. d here we have our We will define the function, after that we will write if there is a function name then the name of the function is any There are variables that we can specify ourselves that we want to name our function after that we write parens and Inside parens we write some parameters have parameters i.e. a function can have If you take any input and on the basis of that input but is returning some output like if We can convert the calculator into a function. If you give, the calculator will take the operator on It will depend on what the output is going to be. So that will become the parameter of the calculator. The parameter comes followed by a colon and then Finally, we have to write as many lines as we want inside together which is the block of code we get We have to write the function, we can write it So suppose we want to write a function want to know what this function does Prints out the sum of the numbers So how do you write the function first? We will write d, we will write the name of the function print sum now after print sum we will write What will you take in parens pensis We will take the numbers first, ours will be first The second will be our second then we will write it with a colon Now these first and second are our parameters in which we will be passing some number And here we will get it printed first plus second and we will place the call from here to do any function means to Execute it, run it and then print To call sum, write print sum Pensies will pass in its parameters Whatever parameters we want to give it I want to give it in first one second want to give it to and this is the print sum which is He will get the sum printed for us. If we run this then the sum of one and two is ours The pass is printed directly which is Thr now suppose we just have to do is a by default parameter with a value of You have to take it like the second number in it, if If nothing passes then seconds for us If it becomes four then suppose we put it instead of two I did not pass anything, I just passed one So in that case it by default will be called second He will take the four and give us the sum of the forest and the fur dega which is going to be five to kuch This way our functions are implemented in our Python If you work inside then I hope that We have also discussed those concepts today We must have understood it well now later if we want to go into programming want to study for placements Reading for Competitive Programming If you want we can implement oops inside Python or else if we do machine learning want to go towards data science want to move towards artificial intelligence then we can read the module related to it Can read file handling etc. are in Python and if we move towards development If you want to go then there is a framework called Jango I hope that your coming Python's journey will be good Apart from this, if there is any topic related to Python You want videos from machine learning or AI If you want a video on any related topic then For that you can comment below today. That's it for you, see you in the next video Till then keep learning and keep practicing