All right, in this video, we're going to create and run our first Python program.
So I've opened up the Sublime Text Editor.
To open this thing, just head over to your Windows Start menu and type in Sublime,
and it'll pop right up.
And go ahead and click the icon, and this is what you should see.
So the first thing we want to do is save this file as a Python file.
So we can head over to File and click Save As.
And now we just want to navigate to our C drive.
So I'm going to click This PC, navigate to my C drive.
And I'm going to find that directory we created in the last video.
And remember, we called it python-excel, so
I'm just going to scroll through here till I get the P's.
And then I see this python-excel, so I can double click it.
And you can see there's our virt directory.
And so just right here we can name this anything we want.
Let's name this hello.py, and then go ahead and click Save.
And when we do that, we see up here it's saved it as hello.py.
If we want to navigate back to our Git Bash terminal,
we can type in the ls command to list the stuff in this directory.
And we can see, sure enough, here's this hello.py file that we just created.
And again, there's our virtual environment directory.
And so that's cool.
Let me clear the screen.
All right, so let's head back over to our Sublime Text Editor and
let's create our first Python program.
So let's type print and then parentheses in quotation marks.
And you'll notice when I type one parenthese,
Sublime automatically puts in the closing parenthese tag.
So that's kind of cool.
Same thing with quotation marks, when I type one quotation mark,
Sublime Text puts in two because you always want to close your tags.
So inside of here, let's type Hello World, okay?
So this is a print function.
It's sort of like a little program that runs inside your program.
And then inside of the parentheses,
we can pass any parameters we want into this print function.
And the parameters we want to pass is this text, these words and
letters, and specifically Hello World.
So let's go ahead and save this.
And when I got the Ctrl and the S key at the same time on my keyboard,
I think it's Cmd+S if you're on Mac or Linux, and then, or
you can come up here to File and then just click Save.
And you'll notice here it says again Ctrl+S, that's just a shortcut.
So now we've saved this file.
Now, in order to run this, we need to run this from the terminal.
And this is the way we're going to run all of our Python programs from here on out.
So head over to your terminal.
It's a good idea to keep your terminal just open whenever you're writing
your code.
Make sure that you're in your c/python-excel directory.
Make sure your virtual environment has been turned on.
If you have since closed this, since we set this up a couple of videos ago,
you just need to navigate back to that directory.
And to do that, we use the cd command, change directory, and
then just type in c/python-excel.
But like I said, we're already in this directory, and
we know that because we can see it right there, and so we're good to go.
So in order to run Python programs, all we have to do is type in python and
then the name of the file.
So our file is hello.py.
So we can run this.
And when we do, we see it prints out to the screen Hello World.
So if you see Hello World,
congratulations, you've created your first Python program.
Now, granted, this is not a very sophisticated program, but
it is the first program.
All coders always write Hello World, it's world famous.
We've all done it and now you've done it too.
So congratulations.
If you're on Mac or Linux and
this didn't work, try python3 hello.py.
So that won't work for us because we're on Windows, but Mac or Linux users,
that may work as well.
So okay, that's really all there is to running Python programs, very easy.
Again, you just type in Python and then the name of the file, and that's it.
So okay, and again, this is a very simple program, but just something to
get your feet wet and show you how to actually save and run Python programs.
In the next few videos,
we're going to spend a little while learning very basic concepts in Python.
Now, I'm going to assume you don't have any Python experience whatsoever.
If you do know a little bit of Python, this will be a great refresher.
If you don't know any Python at all, this will be not too complicated.
And it shouldn't be too hard to learn these things.
We're just going to look at very basic concepts to give you an idea of what
Python is capable of.
And also to give you the tools in order to write the code that we're going to use
throughout the rest of the course, connecting our Python with Excel and
all that good stuff.
So we'll start to look at those things in the next video.