Second example program on console

Second example program on console

Lesson Details:
September 17, 2020

Video Transcription: This is Anand Mahajan you are instructor for this course of Python in continuation of our topic how to write Python programs in notepad or for that matter in any other editor and execute them on the console this video is brought to you by Appy Pie’s Academy, I'm going to give you a second example so let's open the notepad I'm going to write down a very simple program let's open notepad and here I'm going to type my simple program before that let me increase the font let it be 16 or something okay so here I'm going to have a variable where one assigning it well we suppose 1000 where 2 is equal to suppose 900 point 9 8 7 6 something so we have already studied about type method that will give you the data type where 3 is equal to suppose it's Mahajan's nine one nine eight one two one six four nine four nine okay so I'm going to use print then type where one so it's going to give the data type of where one which is of course integer then again print type where two obviously the data type of a two is float so float will be printed print type three and as the data type of a three is string string will be printed it's a simple program before that let me do some calculation also what I will do is suppose wire 4 is equal to where one into this is called pipe busting I am writing int and then the name of the variable bad now what does it mean this is typecasting right let me give the comment typecasting being used in the following statement okay so that means initially originally we're two happens to be a flow data type but here I will type cast it into integer so here we're two only integer part of a two will be picked up so that is it won't be nine hundred point nine eight seven six it will be only nine hundred at this place where I have type casted it similarly you can typecast an int into float vice versa is also true okay so here I'm going to print print let me correct the Spelling's where four is equal to plus STR where I used STR because we're four is of integer type is of numeric type so plus is the concatenation symbol both the site should have the same but a type STR will convert it into string okay so let's save the program as I have already told you that whatever name you gave to the program that is okay but extension ought to be py so I am going to give it the name second dot py press ENTER it is in the folder temp or whatever folder you want to save your program in okay so press on start click on start go to CMD so here I'm going to change the folder CD / tempo will take me to the folder to the directory temp here I would write you might be remembering first we are supposed to give the name of the application Python then we will give the name of our program which was second dot py okay the program has been executed successfully so with class it gives the data type as you know int float STR STR stands for strength and wherefore is equal to this value 900,000 that is getting printed here I have used typecasting so I have typecast it VAT to float data type variable into integer so this is how we have learnt this is how we can write our Python programs in notepad or for that matter in any text editor and execute them on the console but if we have got a very powerful ID like PyCharm and other IDs there is I think you will never like to type your programs in notepad and executing them on console so this was just a demonstration so that when if you are encountered with the need of writing and typing your programs in notepad and console window respectively you shouldn't face any problem. 

loader
Course content