no beginners guide introduction to a programming language would be complete
without the hello world tutorial so in this video I'm going to show you how to
create a simple hello world script using Python if you're not familiar with hello
world all it is is a simple script that you write that outputs the text hello
world the purpose of it is just to teach you how to get set up with a basic
project and how to run this script so you can see it running in real life okay
so let's get started one of the great things about Python is that it's a
really simple language to pick up and get started with one of the reasons for
this is because you can simply just write a Python script in any text file
anywhere on the system there's no complicated project setup or anything
required the downside of this is it can be quite confusing if you have lots of
different Python applications just dotted all over the computer so I like
to store all of my projects in one folder called the workspace so if you're
on a Windows machine open up the Explorer window and navigate to your
home directory if you're on a Mac or Linux then open up the finder and
navigate to the home directory of the user that you're logged in as inside the
home directory create a new folder called workspace this is where we're
going to keep all of the source code for the applications that we write during
this video series inside the workspace let's create another folder called the
beginners guide to Python okay and we're going to create all of our course
all of the work that we do in these courses we're going to store in this
beginners guide to python within our workspace directory alright so now we
can go ahead and create our first-ever Python application load up the atom
editor and click on file and project folder
then navigate to the workspace that we just created and the beginner's guide to
Python directory that we created also and click on select folder this is going
to load up the project in the atom editor and it's going to give us this
tree view here on the left hand side ok so now that we have this all open up we
are ready to create our hello world script the way you create a new script
in Python is you just simply create a new text file and you name it something
.py that's dot py so we're going to call our script...we're gonna right click
right-click the beginner's guide to Python directory click on new file we're
gonna call it hello_world.py it's important not to have any spaces
in the name because then you can't run it easily through the command prompt
it's better to have all the names in Python should be lowercase and they
should be separated by underscores this is just the kind of standard convention
that's used in the Python community Alright if you hit enter there it's going to
create a new empty hello world file and now what we need to do is tell it to
output the text hello world this is really easy to do in Python all you do
is you simply type print open brackets and then put two single
speech marks and type hello world in those speech marks I'm gonna save my file
by pushing ctrl s you can use command S if you're on a Mac or you can click on
file save to save the file to the system alright so that's step one of creating
our hello world script next let's go ahead and run our script using Python
the way that you run scripts in Python is you use the terminal if
you're on a Mac or Linux or the command prompt window if you're using windows
and you navigate to the script and then you run it using the Python command so
I'm using Windows so I'm going to click on start and I'm gonna load up the
command prompt if you don't have command prompt in your shortcuts here you can
just type command prompt in the search and it will come up as one of the
desktop apps if you're using a Mac then you want to click on your applications
and load up the terminal application the commands look pretty much the same on
whether you're using Mac Linux or Windows the screen is a little bit
different the terminal looks different compared to the command prompt but what
we enter into the terminal on command prompt is pretty much the same thing
okay so we're going to start by using the CD command that stands for change
directory this command is used to switch to different directories using the
command prompt just like you would navigate to them using the finder or the
explorer window so I'm gonna type CD workspace and hit enter if you type LS
it will show you a list of directories that are in this new directory that we
switch to you can see that the beginners guide to Python is in there I'm gonna type
CD again and this time I'm going to type beginners guide to Python okay so now
we're almost ready to run our python script if you type LS one more time it will
output the list of items that is in this directory one of which is our hello
world script the way you run the script is you simply type the word Python
followed by the name of the script you want to run and then when you hit enter
Python will execute the commands that you've put inside the Python file so hit
enter there and you can see that it output the words hello world if we add a
few more exclamation marks here save the file
and then run the command again if you just push the up key it will tell you
the last command that you ran and then hit enter and you can see that its
output the changed text okay so that's how you create a hello world application
in Python thank you so much for watching this video I hope you found it useful
and I'll see you in the next lesson