How to Run Python Programs ( .py files ) on Windows 11 ( All Options )

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to the channel in this video we will see how we can run Python program in Windows 10 opt-in system we will talk about the different options that we have in order to continue with this video you need to download and install the latest version of python if you don't know about it then I have already made a video I'm gonna put the link in the description box if you want you can check that out if python is installed in your computer then you can click on the start button and you can search for python then you guys can get python here if you click on that then it will open up the python command prompt interface so it will be an interactive interface where you can type in Python code and you get the result immediately for example if I use the print function and if I say hello YouTube then you know I get hello YouTube as the output immediately so it is an interactive interface and you can use it to write and execute the python programs now if you want to you know close this then you guys can use the exit function and if you hit the enter button it will be terminated another thing is if you want you can get the same interface in the command prompt window for that just open up the command prompt and after that type in Python and you get the same interactive window in this common prompt and here also if you type let's say print and hello world or anything you get the output immediately so it is an interactive mode I'm gonna exit this and we can use exit and close that one now if you want you can write the python code using any Simple Text Editor and you can run that program using the command prompt to do that first I'm gonna open up Notepad you know which is available with every Windows installation and here I can write some python code for example let's ask the user to enter a name and I'm going to use the input function in here and I'm gonna say enter your name and I'm gonna store that input in this name variable and then after that I'm gonna use the print function and I just want to say hello and then we will display the name that will be entered by the user now after writing this program go to file and click on Save and you can save that in any location I'm gonna save it in my desktop inside the coding folder and here I'm going to call this file as hello Dot py and here make sure that the save as type is all files otherwise it will create a text file and after that click on Save and uh now we can close this notepad now the program that we have created is present in this coding folder now here if we open up this folder then we can see the file that we have created Hello dot py so in order to run this program what we can do is we can open up the command prompt in this folder to do that just go to this uh URL or navigation section and just click on that and it will highlight the path here and after that just type in CMD and hit the enter button it will open up the command prompt with the path that we have opened here with this folders path if I use the dir command then you guys can see we have this hello.py file which is the file containing the python code in order to run this python code we can write in Python and then we just have to provide the file name which is hello.py if I hit the enter button it will say enter your name and if I enter Anil it says hello Anil you know which is the output of the program that we have written now the next option that is available to us for running the Python program is to use the idle just click on the start button and search for ideally and you will get the python ideally just click on that and it will open up the python shell now here you know this is the interactive window here we can write the python code for example uh print and I'm gonna say hello and after that if I hit the enter button you know you guys can see I get the output right here and here you have the options of writing the Python program in a file to do that just click on this this file option and go to new file or you can press in control and n it will open up you know text editor for you to write the program so here also I'm gonna write a simple program you know a simple program that I have written you know it will ask the user to enter his name and then it will display hello and the name that will be entered by the user now we're gonna go to file and we're gonna go to save or you can press the Ctrl s and uh you know we can save it wherever we want I'm gonna save it in my desktop now I'm gonna say hello Dot py and after that I can click on the save button and the program will be saved in the location that we have chosen in this case you know it was in the desktop so you guys can see here and now if we want to run this program then we just have to go to run and we can click on this run module or we can directly press F5 key you know it will open up another python shell and it will run the program so here I'm gonna say my name is Anil it says hello Anil you know a simple way to write the Python program in a file and run it so this is how we can you know run a Python program in Windows 10 by using the command prompt and also by using the ideally if you like this tutorial then hit the like button if you don't like it hit the dislike button if you want to say something then write that in the comment box for more tutorials like this do subscribe to the channel thank you for watching see you later in the next video
Info
Channel: Example Program
Views: 1,241,887
Rating: undefined out of 5
Keywords: Python, Python Program, Python Programming, Run Python Program on Windows 10, computer programming, python tutorial for beginners, python tutorial
Id: Qi28uPKaH_A
Channel Id: undefined
Length: 6min 13sec (373 seconds)
Published: Fri Jun 12 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.