Get The Learn to Code Course Bundle!
Enroll in The Complete Python Course on Udemy!
Let’s create a Python script and learn how to run it. I’m going to be doing this within terminal, and you can follow along on MacOS, Windows, or Linux. First, I am going to change into my “pycharm projects” directory and there’s nothing really here, so I’m going to create a file using the nano text editor. If you are Windows, you will not have access to nano in the command prompt. I’m just going to call the file test.py. All Python scripts need to have the .py file extension. We will use the classic programming example of print(“Hello World”). I will save the file, and if we just type “test.py” you will see that BASH doesn’t know what to do with this command since test.py is not an installed program. What we need to do is run “python3 test.py” and it will return the result of anything within the script. So, that was a quick video on how to run Python scripts in terminal, in the next video we will setup our integrated development environment.