How should I start learning Python?

Week 1: A Brief Introduction To Python · Lesson 3 · 10 minutes


You might be wondering: How and why should I start learning Python? To help you answer that, we’ll look at various programming languages and compare a few popular ones with Python. You'll find out why Python is a useful tool to have under your belt whether you are learning your first language or looking to learn an additional one. You’ll find out why Python is especially a good language to learn for first-time developers.

Before you learn Python understand web development basics 

Before we install Python, let's think about where we need to start with it, and what we want to build. 

Web Applications are tools you access over the internet. You open up a browser, and go to a website, and load an application - which lives on someone else's computer, but is being shown to you through your browser. 

Front-end vs. back-end

Every application has both a front-end and a back-end.

The front-end is what you see on the browser, and the back-end is what handles the work behind the scenes: a database that stores everything you need, and rules, which connect the information in your database to the way you want it seen on someone's browser. 

The main front-end languages are: 

  • HTML
  • CSS
  • Javascript

Databases

  • Examples: SQL, MySQL, Postgres  

Resources 

Learn more about front-end vs. back-end

- So I know you're thinking,
but Mattan, where do I actually start?
There's so many different terms that I've heard about,
there's C and Java and PHP,
should I learn Python or Ruby, or JavaScript,
I hear that's the new hotness.
So I wanna demystify a little bit for you
about that over the next few minutes
so that you can feel better knowing where to get started.
I'll start with the idea of a web application.
A web application is an application
that you access over the internet.
It's just like an app that you download on your phone
or even one on your computer like PowerPoint or Excel
but instead of downloading it,
you're gonna open up a browser, Internet Explorer,
Firefox, Chrome, Safari, whatever you're using,
you're in a browser right now
and you go to a website like Twitter or Facebook
and you're loading an application
on someone else's computer and it's being shown to you
through a browser.
And the reason I'm telling you about this
is 'cause it gives us an understanding
of how a typical project may be coded.
Not every application has a front-end and a back-end.
And the front-end is what you see.
There are three primary front-end languages
for producing the webpages that you see.
There's HTML, CSS, and JavaScript.
And it's not one or the other here,
actually all three of these are gonna be used
on every page that you go to for different things.
We're not gonna get too far into front-end in this class,
if you are curious about that,
you should check out our One Month HTML class,
Programming for Non-Programmers or One Month JavaScript
and learn more about these languages specifically
but suffice it to say
that for every web application you have,
you're gonna need these languages to create the webpages.
But you also have the back-end
which is the part that you don't really see.
And this is the database which is where all of your data
for your application is gonna be stored.
Yeah, that's your users, your pictures,
your tweets, status updates,
whatever your application is dealing with
and needs to be able to show users,
especially once they close that page
and then open it up again later,
maybe on a different computer,
all that is stored in a database.
And what you have is a connection between the database
and the webpages that are created by your application
and those are what I'm calling the rules.
The rules that decide when someone goes to a specific page,
what information do they wanna see
and what do I have to go and pull out of the database?
So as far as database languages goes,
that's actually pretty simple.
There's really only one and it's sequel or SQL.
Either one of those pronunciations is fine.
But in-between these rules,
this is where programming languages really come in,
this is where they shine.
You've got languages like PHP,
Python, Ruby, Java,
JavaScript can even be used in here in some cases,
C++, C, so many different languages,
this is where most of the things
that we saw on that previous slide with all those terms,
they fall in, they fit into these rules.
Now the thing for you to realize
as someone who hasn't coded before
is that they're all the same at the end of the day.
They're a little different
in terms of how they actually look
but you can do the same thing with all of these languages.
So I'll give you three examples in PHP, Python, and Ruby.
Now here's a little bit of code, color-coded by PHP in blue,
Python in green, and Ruby in red.
In PHP, you've got echo "Hello World";
and there's little quotation marks.
Python, you've got print("Hello World")
and Ruby, you've got puts "Hello World".
Now if I run this code and we'll talk more
about what running code actually consists of
later on in this class but if I run this code
and the end result I get is the text Hello World.
So the outcome is exactly the same
but the way that it looks is a little different
like you might have noticed
that the PHP has a semicolon at the end,
that Python has that parenthesis around the Hello World,
Ruby doesn't have either of those
but the end result is exactly the same.
So I often have students, when they're first starting out
learning to code, they come to me and they tell me
about their thing that they wanna build.
And they describe all the features
that this application could have and then they ask me,
so which language should I build this in?
And it's a bit of a weird question
because it doesn't really matter.
It would be like coming to a writer
and saying oh I have this great love story I wanna tell
or this great mystery novel I wanna write,
so should I write it in English,
or should I write it in Spanish,
or should I write it in Chinese,
or should I write it in French?
You know the question is kind of irrelevant
because you can write the story in all of those languages
and of course the languages are different
but it comes down to which language do you know?
Which do you prefer?
Some languages have male and female verbs and nouns
and different tenses and stuff like that
so they're different, it's not to say
that they're all exactly the same
but it's not that any one of them
is particularly well-suited for what you're trying to build.
I will say with a caveat, the only exception to that
is if you're doing mobile development,
if you wanna develop for an iOS app or for Android,
there are specific languages that both of those platforms
do use because it's kind of a locked-in system.
With iOS it would be Swift, for example.
But even so, another caveat to that caveat,
if you wanna build a mobile app,
all mobile apps will have some sort of back-end
of interacting with the database, essentially an API
that is how users store their information off of their phone
and those APIs will usually be built
in one of these languages anyway.
So even if you wanna build a mobile app,
I still would recommend learning one of these languages
and in this case, Python,
it's very easy to build an API in Python
using web application
and then you can build the mobile app on top of it.
So it's not like by learning Python,
or learning any of these languages,
you're making it harder for yourself later.
Also it's pretty easy to switch
and I'll honestly, I started with Ruby
just because you know that's what I started with
and I learned Python
and I learned a bunch of other things since then.
So what is Python?
Well Python is just a language
for humans to talk to computers.
And that might not be so clear to you
like how do humans talk to computers?
Well, languages just started off
being very computer-friendly but not very human-friendly.
So when we think of programming and we think about binary
and like almost everyone's familiar
with the idea of binary.
Like this is what some binary code might look like.
So if you wanted to do something like pretty simple,
print the text winter is coming,
this is what you would do if you were writing that in binary
and it's kind of insane.
There's no way that anyone would sit down
and really remember and know how to do all this
and write this code with zero zeros and zero ones
and file that into a computer.
At least not nowadays, it's much simpler
but when computers were first invented or created,
this is what you had to do,
you literally had to take punch cards
and you had to write these things from scratch.
And then people decided, well that's way too difficult,
and they invented something called Assembly.
And Assembly makes it, it's one level up from binary,
it just translates one for one.
So here's how printing winter is coming
might look like in Assembly,
it's still much too complicated as far as I'm concerned,
I would never, ever try to write something in Assembly.
Some people do, they write like operating systems
or things like that but this is
and it's still pretty old school.
And then you have Java
and Java is not a new programming language,
it's been around for a while
but it definitely made it easier to build larger,
especially enterprise scale business size applications.
And this is how you might print winter is coming in Java.
But there's still a lot here.
And so my complaint with Java
and some of the older languages is in order to do something
as simple as printing a little bit of text,
there's all the stuff you have to understand first
like what is public class, public static void,
main string args, like every single of these
is a concept you have to learn before you can do
something as simple as just print some text.
And then you've got Python, breath of fresh air.
All the things we did before,
in Python just translates into this one simple line
print("Winter is coming.") and it's simple.
And so it's easy to get started with that
and then move on to the next lesson.
So that shows you the evolution of programming languages
and it shows you how we went from something
where this is very easy for a computer to understand
but hard for a human to understand,
to this which is much easier for a human to understand.
Now of course a computer understands this
basically by translating it back
into binary at the end of the day.
So there's translation that has to happen
but for you and I, we get to deal with Python
and it makes it much easier for us to think about
and build something cool that we wanna build.
So what is Python?
That's what I'm gonna talk about in the next video.