-
What I want to do in this video is to introduce you
-
to what a computer program is.
-
I highly recommend you follow along
-
because the real way to learn computer science
-
is to really fiddle with things yourself.
-
This is a Python environment. I'm going to be doing a lot
-
of the programming in a language called Python.
-
This environment is called PyScripter. It's free,
-
it's an open-source piece of software and I believe
-
I'm using Python 2.6 or 2.7. As long as you are using
-
Python 2 your examples will be the same as mine,
-
They will work the same way. But If your using Python 3 you are going to have
-
to use slightly different variations every now and then
-
to make it work properly. I'll try to make notes for
-
those when they occur. So lets just start writing ourselves
-
a computer program. What's cool about this is, we can
-
write our computer program right here
-
and really we are just editing text in a file. That's all it is.
-
It's a set of instructions and the computer is just going
-
to start at the top of this file and just go down
-
and read the instructions., although you will see
-
later on that there are ways to tell the computer to jump
-
around and loop around within the instructions, so that
-
it can do things over and over again or skip parts of the program.
-
With that said lets write ourselves a simple program
-
and while we do this we will expose ourselves to some of the
-
core concepts that exist within a computer program.
-
So let me just write a very very simple computer program.
-
So one very simple computer program
-
would literally just be an expression.
-
So let me just write 'print 3+7', so it's literally
-
just going to take 3+7 and print it. It's going to pass
-
it to the print function which comes with Python
-
and maybe I will write like this: print(3+7)
-
Lets save this file. So there's literally only on command
-
Not Synced
here on the top line that says print 3+7.
-
Not Synced
Actually, let's add another command,
-
Not Synced
just so you can see that it's going to go top down.
-
Not Synced
let me add another one: print(2-1)
-
Not Synced
and lets do: print("this is a chunk of text")
-
Not Synced
Now let's see what this computer program is going to do.
-
Not Synced
Let me save it. I saved it as the file "testarea.py".
-
Not Synced
The .py extension signifies it is a Python file.
-
Not Synced
Now let me run the program. What's nice about these
-
Not Synced
IDE or Integrated Development Environments is that
-
Not Synced
you can type and run the program in the same place.
-
Not Synced
It also color-codes your text, so you can see what's a
-
Not Synced
function, what's not a function, the different data-types...
-
Not Synced
Let's run the program to see what happens.
-
Not Synced
So there we go, we ran it!