Hey, you're still sticking around.
That's good.
I didn't bore you with all my talking, but yes, in this video, finally, we're going to write some
python code.
Holy moly.
Thank God.
I thought that was going to last forever.
All right, so what is our first program going to do?
Well, let's create a very, very simple function.
And probably the first thing any programmer learns to do to print our own name.
So in here, once you have your replica set up or remember, you can also use glottal audio.
We're simply going to write print.
And then you see over here that it gives us some information.
But all we want to do is write brackets, a quote.
So you can do double quotes here or a single quote and just type your name.
And if we click Run.
On the right side.
We've just written our very first Python program.
Very exciting.
But what's happening here?
Well, let's let's look at everything.
First of all, if you're confused why my thing is dark and yours might be light.
It's because if I go to settings, I've set my theme to light or to dark.
I prefer the dark version, but you can change some of your settings.
You can change the font size if you want based on when you watch the video this website, the look might
be different, but most of the settings should be the same.
We see that we have a main dot pi, which is the python extension.
Any file that has a dot pie or pie is a python file.
So what we've just written here on line one is a program that prints in this case Andre Nagoya, or
in your case, your own name.
And we've written it to this file.
Now, wrap all that it takes.
This file already has this interpreter.
For us, it runs this piece of code, gives this source code of main pi to the interpreter and runs
it right here on our right side.
If you look over here, we're using Python version 3.6.1, and down below we see that we have Andre
now printed.
That's awesome.
So this is our code running.
Remember this diagram.
All we've done is we have our main pi where we wrote print.
Andre Nagoya.
We gave it to the interpreter that the ripple already provides for us.
That interpreter takes our code, converts it into bytecode.
And here you'll say Andre Nagy.
And then it runs it in the C Python VM, which was on the right side that we saw.
And it finally prints our name because it tells the machine, Hey, we want that text printed.
So that's what we're seeing here.
This is the C Python virtual machine, essentially running this code and telling this machine, Hey,
I want you to print this.
All right.
But this isn't very exciting.
I mean, let's let's make this program a little bit more dynamic for our first program.
We want to do something more impressive than just print name.
So I'm going to teach you another thing we can do in Python and it's called input.
Now in here, I can say input.
And you see that ripple?
It actually gives me some information saying that, oh, I have this.
You can just click here and this input over here.
Well, what can we do?
This input is going to prompt a user and if I hover over it, you can see how it's giving me some information.
But input simply gives us a way to capture information.
So let's say, what is your name?
And if I run this code.
We see that we have our Python code running and it's asking me what is my name with this cursor here
so I can actually type something here?
I can say Andre.
And if I hit enter.
Well, there you go.
I've just.
Typed in my own name.
Nothing that exciting, right?
But this is where code becomes interesting because we can store this information on our computer.
So again, these are things that we're going to go over in detail in our basic Python section.
But just to write our first code, let's assign this to memory.
That is, let's say that name equals whatever is the input of what is your name?
And then finally we can just print.
The name.
So remember, the interpreter is going to take this first line.
It's going to ask, what is your name?
I'm going to type something.
That type of information is going to get assigned to name.
And then finally we print name.
Remember, an interpreter takes line by line, converts code to byte code, and then finally runs it.
So let's give this a try.
I'm going to click Run.
All right.
What's your name?
My name is Andre.
Did you see that?
I typed in my name, hit enter.
And then it printed out.
Andre.
So for the final feet, let's greet.
So we're going to say print.
Hello.
And then plus name.
Now, don't worry about the syntax.
We're going to go over it.
But all we're doing is saying hello and then adding our name to the end of this.
So let's see what happens if I run this and say, What is your name?
My name is Andre and I hit Enter.
I get.
Hello, Andre.
But no spaces.
So let's add a little space.
Hit.
Run again.
For the fourth time.
My name is Andre and says, Hello, Andre.
There it is, our first Python program.
Now, it's not very exciting because it is our first program.
We're just learning the steps here.
But I hope because we've covered some of these topics ahead of time, that this isn't just pure magic.
Right.
You understand that this is source code.
This is Main Pi that we give to an interpreter that runs our code line by line and then executes our
program in this case.
Ah, what is your name program?
How cool is that?
This is just the beginning.
We're going to get more and more advanced here.
See if you can play around with this.
We don't know that much about Python yet, but I hope this gets you excited because, well, there's
a lot more coding coming along.
I'll see you in the next one.
Bye bye.