Posted on

Learn Python Episode #4: Running Scripts in Terminal

Enroll in The Complete Python 3 Course: Beginner to Advanced!

Click here to subscribe for more videos like this!

So, let’s go ahead and create a Python script and learn how to run it. So, I’m going to be doing this in terminal completely we will discuss other options later, what I need to do first is change directory into “pycharm projects” and there’s nothing really in here so I’m going to create a file using the nano text editor, you guys don’t have to follow along, however if you want to that’s great too. I’m just going to call it test.py. Now all Python scripts need to have the .py extension. So, what we’re going to do is just a simple, simple script it’s going to print “hello world” So, I’m going to control + O to save, and control + C to exit, control + X to exit. Alright, now if we just type “test.py” you’ll see BASH doesn’t know what to do with this command because test.py is not an installed program. So what we need to do is run “python3 test.py” and it will return the result of anything in that script. So, that’s how to run python scripts, in the next video what we’re going to be doing is setting up an actual work environment using an IDE, and get you guys all ready to start with the basics.