Posted on

Learn Python Episode #5: Creating and Running our First Script

Get The Learn to Code Course Bundle!
https://josephdelgadillo.com/product/learn-to-code-course-bundle/

Enroll in The Complete Python Course on Udemy!
https://www.udemy.com/python-complete/?couponCode=PYTHONWP

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.

Webhttps://josephdelgadillo.com/
Subscribehttps://goo.gl/tkaGgy
Follow for Updateshttps://steemit.com/@jo3potato