DATATYPES , VARIABLES & IDENTIFIERS - PYTHON PROGRAMMING

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello friends welcome back to our channel so in today's session let us have a look on different variables and identifiers and then different data types so in the previous sessions we have seen the basic introduction to Python interpreter so how to download and install the interpreter and then we have seen various literals that is the numbers and strings and now we will move on to the variables and identify and analyze now let us start with them variable and identifies variables and identifiers so as we know the variable is an alternate name given to some memory locations so this we have seen in C language also so in our system everything will be stored in a memory and that memory will be having the unique addresses which is in a numerical form and in order to remember this that addresses is somewhat difficult so that's why we are giving some alternative name to that particular memory address so that we call it as a variable so as the name itself indicates according to the logic according to the expressions or according to the instructions the value of that variable may be DS so it's not a constant it's available if it is a constant the value in that memory location will not be changed as it is available the value of that memory location can be varied that means so we can assign a value to the variable and we can also reassign the value to the same variable so we can update the variable with one more leg or with the same way right so here the one more thing we'll have seen that is the island difference the name itself indicates identifier is used to identify the elements right so here the variables comes under the example of hiding defects similarly some functions objects classes everything will be comes under this identifier for everything we are giving some name so by using that name we are identifying the particular object or class or a function or this way right so a variable is an name given to memory location right next identifies examples variables classes objects more juice functions and also constants right so all these are the examples of this an interface right so for any identifier we have to follow some rules while giving a name to that particular identifier so which is similar to our C language so we have to give some name to that number location and that must be done by following some set of rules now let us see the rules to be followed for giving the name naming of and in fare rules the first and foremost food is so like the senior in C language here also there are some keywords so as we have discussed in the C language a keyword is a reservable words given by the compiler or an interpreter which is having a specific task so for every keyword there will be some specific meaning and some specific work to be done so first to this first and important and foremost rule is the variable name should not match with any keyword need so the variable already different we can call it the s both available or identifier variable name should not match with keywords so in Python also there are different keywords so I will explain you later right so first we will see the rules so variable names that means identify things you should not match with any one of the keywords second one the nail consists of alphabets or numericals that means digits right so everywhere edit where name should start with either character or underscore the rebel name should start with character ah understood the simple under school right underscore symbol so exit this underscore we should not use any other special characters in the variable name and this character can be upper case and lower case it can be booked right anyone either uppercase or lowercase and also it can start with underscore and invariably only accept the under school no other special symbol will be allowed the rule it can be alpha numeric variable name can be all fall numerator that means characters plus disease enumerators okay but the variable name should only start with the character an underscore it should not start with numbers never occurs and the fourth one right it's a case since two variable names are case sensitive case sensitive that means example if I write a B C or D name right so name is available and it is different from name because he had in this capital in any small so these are the two variables the interpreter will treat it as an to variables name a name so capital n so it's the case since two should follow the variable name right and so these are the same rules to be followed while giving the name to the very goose on identifier so how to follow these rules right now let us move on to the datatype hope you understood this simple thing so the same we have seen in the C language itself so if you compare this python with a see everything is same coming to the variable and any difference now we will move on to the datatypes see their lips so when compared to the C language here we can see the change because coming to the C language so for every Delta there will be some day today and for every every variable should be declared before they are using in the program but using these data types right so if you want to declare one individual variable so if you want to use one integer variable first we have to declare that variable by using this data type so the declaration is me right so before using them here there are different data types that is numbers so in numbers we will get integers float complex everything we will treat it as a numbers next strings here we will consider character and strings okay so there is no special character data type right so like in the C language where we will be having some care in order to represent one character better than a min one character so here even there is a single character we can treat it as a string and effort from these two there are different things that is wished to cool diction so all these are the different data types right so Nevers chains list tuple and dictionary coming to the numbers failure will be in digit numbers floating numbers complex numbers and strings there are two categories and strings right so we will keep these three aside first let us see about these two numbers and strings now so in C language if you want to declare an integer datatype so what are the steps in we have to use a keyword int yay that is the declaration part J is equal to 5 this is the initialization part so this is the declaration this is the initialization right initialization which assigning the value to the variable but so this is the C language now coming to this Python it becomes very easier right it becomes very simple so a single statement J is equal to 5 automatically includes the initialization and declaration so there is no specific data types to declare a variable the assigning value to the variable itself tricks as a declaration and initialization in Python programming so these two to three statements can be replaced with the only one statement in Python programming so this statement implies J is available to store numeric data and assign sorry si so here the single statement in our Python programming will use the declaration and initialization so there is no specific data types to declare the variables directly we can assign a value to the variables so if you want to add it to numbers if you want to add two numbers so in C language if you want to add two numbers in C average simply we have to declare two variables in the a comma B and also 30 variable C next ya is equal to sum 5 B is equal to sum 6 C is equal to a plus B right come to this Python then key we can declare a is equal to 5 V is equal to 6 so that implies two variables antics were using the in numbers integers and what you see is equal to M plus D only three statements so there is no declaration part in Python there is a very most important point directly we can assign a value to the variable it will automatically because it gets the declaration so how grammars of this then let us let us take the example examples so name is equal to either question is equal to three point six point five something next price is equal to 300 okay next simply we can write sum C is equal to 5 plus 4i right so directly these four statements implies the name the variable name is having the value Python and washer is declared as I mean this is a declaration string this declare doesn't float okay three point six and price this is declared as int and this is declaration complex like a single statement will get the declaration and initialization hope you understood this example next next one coming to the comments so how this can be comments can be used in Python program so in C sub Cummings in C we have to use these symbols so whatever the data which is written in between these two symbols will be considered as a comment so that particular data will not be executed by the company so in Python the Python the comment is represented with hash so whatever the data which is having the hash in at the beginning that line will be considered as a comment it's a single element so it is not chosen for multi lens right if you want to give a dimension in two lines so you can use two dashes simple right now in this Python the assignment of variable can be done in multiple ways so multiple assignment in a single line more than one variable can be a same multiple assignment right so for example sum is equal to zero flag is equal to 0 D is equal to 0 B is equal to 0 so if you want to deter this one these things we have if you want to assign the values to these variables this can be right this can be written in a single line by using this multiple assignment simply you can hike sum is equal to flag is equal to J is equal to B is equal to Z so the single line statement we give a multiple assignment so variable sum is asking to zero flag is s in to 0 yes si to 0 B is a set to 0 so all the four variables are assigned with a single value that is 0 and that can be represented by using single statement in Python next if si so if you want to ascend this one sometimes equal to zero some flag is equal to one then is equal to Python and version is is equal to three point five if you wanted to declare these four variables and if you want to assign these four variables with different values this can also be done by using a single statement in Python that is see some comma flag come on being questioned is equal to C 0 comma 1 comma fight on come on the point fact so this is the single statement where we are going to use in Python for multiple assignments so here all the four variables are assigned with the four values for different values so this is also a valid statement in Python so it will check the order write sum is equal to zero flag is equal to one name is equal to Python margin is equal to three point five so this happens only because here the declaration part is ignored so there is no explicit declaration part directly assigning the value to the variable will give the declaration so this can be done in Python right hope you understood the multiple assignments we can multiple I mean we can assign a multiple values to multiple variables using a single I know if more than one line to be represented in a single line so here the most important thing is no statement will end with a semicolon so in our C language every statement will end with the semicolon semicolon that indicates the termination of the particular mine but here python there is no semicolon there is no way of using this semicolon right so simply a is equal to 5 m that always terminates the line so it is equal to 6 it also tells the line there so no this silicon is not required in every line okay now if if we want to represent more than one line and then more more than one statement in a single line that was more than one instruction in a single line so this will become right so if you want to represent more than one instruction in a single line so J is equal to 5 when V is equal to 6 if you even want to represent this in a single line directly we can write a is equal to 5 sorry yay comma B is equal to 5 comma 6 this is one way and the other another way is by using semicolon so if you want to represent more than one instruction in a single line so this can be written a is equal to 5 semicolon B is equal to 6 semicolon C is equal to a plus B right so in order to represent more than one instruction in a single line we have to use the same color right so we need not require the same common for every line of Python program hope you understood this the different data types variables in identifies and the rules to the file to give the name for identifier and then SN assignment so i setting the value to the variable so no specific decoration part and there are multiple assignments so we can really assess the value so if first light consists of a is equal to five and then the second length B is equal to 6000 a is equal to six automatically this 5 will be replaced with 6 that is various any so because here it is a variable we can update the value right any assignment is possible multiple assignments it will be possible in a single line and the comments are used by using by adding hash as a prefix to every line and then semicolon is used to differentiate two instructions right so if you want to represent a more than one instruction single line we have to use this synagogue so hope you understood all these things so if you really like my videos like my videos share my videos with your friends and if you are having any doubts regarding this Python programming feel free to post your doubts in the comment section so that I will definitely try to clarify all your notes and don't forget to subscribe to our Channel and thanks for watching thank you very much
Info
Channel: Sundeep Saradhi Kanthety
Views: 141,338
Rating: undefined out of 5
Keywords: SUNDEEP, SARADHI, KANTHETY, PYTHON, PROGRAMMING, HIGH-LEVEL, LANGUAGE, PORTABLE, FEATURES, APPLICATIONS, INSTALLATION, INTERPRETER, PYTHON SHELL, PYTHON SCRIPT, INTRODUCTION, BEGINNERS, GUI, GAMING, WEB DESIGNING, PYTHON 3.7.0, PLATFORM INDEPENDENT, CASE SENSITIVE, SIMPLE, PYTHON BASICS, DATATYPES, VARIABLES, ASSIGNING VARIABLES, IDENTIFIERS, NUMBERS, STRINGS, RULES, INT, FLOAT, COMPLEX, MULTIPLE ASSIGNMENTS, REASSIGNING, INITIALIZATION, DECLARATION, INPUT STATEMENT, OUTPUT STATEMENT, INPUT(), PRINT(), COMMENTS
Id: 1nxGRg01wao
Channel Id: undefined
Length: 23min 40sec (1420 seconds)
Published: Mon Jul 23 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.