To begin, open up your browser and head over to this URL.
Now, if you didn't want to type all of that out and make some typos and errors
and not get to the right place, then simply just head over to the course
resources and click on the link there.
It'll take you directly to this page.
Now, once you've clicked on the link that takes you to the starting Replit
you should see something that looks like this.
And the first thing I want you to do is to go ahead and click on the Fork Button.
What this is going to do is it's going to create a version of that
same Replit that you'll see me working through in the videos,
but in this case, you'll be able to edit it.
So if you want to save the work that you're doing, I
recommend signing up to Replit
.
It's completely free.
You don't need any credit cards or anything.
Once you've created your account on Replit,
it will take you to the previous page where you can now
actually click the Fork Repl button.
And what that will do is it'll create a copy of what I've created
and put it into your account.
And then you'll be able to see a record of all of the code that
you've written throughout the course.
In this course, you'll be coding along with me on Replit
and completing a whole bunch of interactive coding exercises in our Replit
classroom.
So go ahead, pause the video, sign up to Replit
and make sure you've forked the starting copy of
"day-1-printing-start" and you should be on a screen that looks like this.
And once you're signed in, then you can actually go ahead
and edit the name of the Replit
or add a brief description and you'll be able to access it later
on through the My Repls folder.
Now once you've done that, then let's go ahead and walk through
some of the different parts of Replit
that you'll be using.
First on the left-hand side pane here, you've got some files
and you can see the current file that's open is this Python file here and you
can create new files or you can create new folders and later on we'll be using
these features to organize our code.
Now the other part of the left-hand side pane that's really useful is the settings
tab here and I recommend everybody to switch their font-size up to large.
This just makes it so much easier to identify mistakes and any typos you make.
Now, we're going to leave everything else as it is, and you can click
on the settings button to collapse that pane, so that you end up
with more space for writing code.
And this area here is where you're going to be doing that.
All of your code is going to go inside here, and once we're done
with writing our code, we'll click Run, and it will execute, and the
results of our code will come up over on the console in the right here.
And I generally prefer to code using a darker background.
It's slightly easier on my eyes, especially when you're working at night.
So these are some of the most important parts of
Replit,
but the important thing is it allows us to just get started.
Now remember that the whole reason why we're learning to program is to be able
to tell the computer what it needs to do and for it to follow our commands.
So let's go ahead and tell the computer to do something.
And we're going to do that by writing our first line of code.
So in this case, I'm creating something called a print function, which is just
the word print all in lowercase, and then followed by a set of parentheses ().
Now, inside these parentheses, I'm going to tell it what I want it to print,
and hopefully it's going to output that inside our console.
So I'm going to start off by writing the classic "Hello world!' inside here,
and then once you're ready, then go ahead and click Run.
After a few seconds, you should see the computer follow your command,
namely printing the words that you told it to print inside the console
or the output area over here.
And once it's done, it indicates that with the little orange arrow.
And the way that this command works is super simple.
You have the keyword print, followed by a set of parentheses(), and then
inside the parentheses, you tell it what you want it to print.
And once you've inserted that, then when this line of code gets executed
by the computer, it'll know to simply print o r output the thing that you've
placed in between the parentheses.
But notice here that it's not just the word, "Hello world!",
that I've put inside my parentheses,
I've also added some quotation marks or double quotes around the word.
And the reason why I've done this is so that I can tell the computer
that this bit here in between the double quotes is not code.
It's not like print where it's supposed to do something.
This is just some text that I've made up that I want it to print out.
And these pieces of text in programming lingo is known as strings.
And you can imagine it as almost like a pearl necklace, right?
It's a string of characters.
And what the double quotes do is they basically show the beginning and the
end of that string of characters.
So that means you have to be really careful when you're typing.
For example, if I go ahead and I miss out the closing double quote, well, now
you can see that there's some changes that have happened to our code already,
namely that the last parentheses, instead of being colored in white
like the opening parentheses or how it used to be, it's now colored in
orange and this is a subtle hint to us.
You're going to get really attuned to these subtle hints because they
are the clues that will tell you what might have gone wrong in your code.
If I run this code as it is right now, it's going to break.
It's going to give me a syntax error and it says something that seems
like it's completely non-English.
So how can we figure out
what this means.
Now, the thing I want you to know is that all programmers make mistakes.
We all make lots of errors, like forgetting to add the double
quotes at the end of the string or forgetting to add a closing
parentheses,
these things are just common errors because we're human.
But the thing that differentiates great programmers is we're really
good at figuring out what the problem is and how to fix it.
So you can imagine that coding is just a whole bunch of
problems that you have to solve.
And in this case, when we get some sort of red text on the right, and our code is
not doing what we expect it to do, then all we have to do is take this entire
error message where it says something, something error, and this is some sort of
message that we're supposed to understand.
And we're simply going to drop it into Google.
And usually the first link you come across will be from a
website called
stackoverflow.com.
And this is basically the Q& A website that all developers will go to whenever
something is wrong with their code or when they can't figure out how to do something.
So if we click on this link, you can see that somebody else has also had
this error and some kind souls have told us that the solution might be
the fact that you're missing a double quote before the end of the line.
So if we take a look back at our code, the code that generated
this error looks like this.
And indeed, we are missing a double quote at the end of our string.
As you're learning to code, as you're going through your 100 days
I want you to become more and more attuned to the color of your code,
because one of the most helpful things that code editors such as this do for us
is something called Syntax Highlighting.
For example, when I was missing that double quote, it highlighted this
entire thing in this orange color.
And that is basically it telling us it seems like this whole thing is some text,
it thinks that all of this is a string and that we're missing a closing parenthesis.
So if you notice this and you're like, wait, actually, that's not right,
this part should be orange because this is what I want to be printed,
but this part should match the color of the open brace, which is white,
so there must be something wrong here.
And indeed, if you have a look at the error message, it actually has
a little caret sign right here showing you that there's something
that's probably not right here
and it might jog your memory that, "Oh yeah, I've forgotten a closing
double quote."
And now when we run our code, you'll see that it's good as new.
So now it's your turn to try it out in a code challenge.
Head over to the next lesson, sign up to our classroom, and then I'll
guide you through getting started on your first coding challenge.
So all of that and more, I'll see you on the next lesson.