0:02
Welcome to watch my video. In this video, I will show you how to run Python code for beginners
0:10
There are three methods to run Python code. One is run Python code in Python Interactive Console
0:17
The other is using a Python built-in IDE. And the third one is write Python code in Python source file
0:25
and then use Python command to run the Python source file. Okay, first, let's see how to run Python in actual console
0:33
Okay, open the command prompt. And then import the command Python. Then you will get into the Python interactive console
0:46
Then you can write Python code here. For example, print on word
0:56
For example, calculate some mathematics. Okay, yes, if you want to exit Python interactive console
1:05
you can do the exit function. This is the first method. And the second method is to use the IDLE
1:16
IDLE is the Abbreviation of Integrated Development of Language Environment. Okay, if you want to run IDLE on Windows
1:26
you can click here, search box and input IDLE. Okay, then click the IDLE application to open it
1:40
Now you can write Python code here. Sorry
2:07
Okay, this is the second method. The third method is to write Python code in a Python source file
2:15
Okay, and then save the Python source file and use the Python command to run it
2:21
But you should remember the Python source file must end with .py as the file extension
2:29
Okay, open a text editor. And then I use sublime text to input the Python source code in the text editor
2:53
And then save it. Save it with .py as the file extension
3:12
Okay, then we will go to the directory D where this Python file is saved
3:19
Okay, open the command prompt. And then go to the directory
3:30
You can see the test.py file is here and run it. Just input Python and
3:48
Okay, you can see the output is just the Python source code is the result in the Python source file
3:56
If we change the Python source file, run it again
4:07
As you can see, if we just input 1 plus 1 here and save the file and then run the Python file in the command prompt
4:19
the result will not be printed out. Yes, so if we want to print the result of 1 plus 1, you will need to use the print function
4:36
Otherwise, you can save it. Then run this Python again. You can see the result here
4:48
Yes, this is all for this video. In this video, I tell you three methods to run Python source files
4:55
One is through Python interactive console. The other is using Python IDE
5:02
And the third one is to write Python code in the Python source file and then run the Python source file using the Python command. Okay
5:12
If you want to read the text version of this video, you can download this URL
5:17
And this post is written by me on my website, dev2qa.com. Thank you all for watching my video
5:28
You are welcome to subscribe to my channel. I will create more Python videos for you to share my Python programming experience