Today, we are talking with Mattan Griffel (@mattangriffel) about how to learn Python. Mattan teaches code to MBAs — at Columbia Business School. He also teaches the Learn Python course here at One Month.
Why learn Python?
- Python is one of the most popular languages for data analytics and web development
- “Python is the new Excel” being used in business school finance classes.
- Google, Instagram, Uber, and many more companies are using Python.
- Many jobs these days require python skills: from data journalists to marketing, and doctors.
In this episode, you’ll learn
- How Mattan learned to code
- Example Python projects beginners can build
- The best programming language to learn first
- The best way to learn python
- Free Python resources for beginners
If you’d like to learn with Mattan? You can find out more about Mattan’s online python course.
🐶 Please subscribe and rate the Learn to Code Podcast on iTunes! ❤️
Here’s my interview, with Mattan Griffel:
Mattan, how did you learn to code?
Mattan: I started by learning Ruby on Rails, which is basically Ruby. Ruby is like an alternative to Python, and I loved it. I started with that because, I wanted to build a website, like a product, basically. And one of my friends knew how to code pointed me in that direction. And so I was like, “Okay, I’ll do whatever you say. “I’ll learn that.”
Chris: You didn’t know how to code at all? So your friend helped you? He must have seemed like a magician.
Mattan: Yes, exactly. He wasn’t like someone who studied computer science in school, he was a coder. He was someone like me, who was just bored one summer, and picked up a book, and taught himself how to code.
What did you study in college?
Mattan: I studied finance and philosophy. I did my undergrad in two different things, totally unrelated. Not coding.
Chris: Okay, yet you made it here to teaching coding at business school.
Mattan: That’s right. It’s kinda surprising to me.
Chris: Do the business school students know that [you didn’t study coding]?
Mattan: Yeah, they totally know that. ‘Cause I bring it up, and honestly, I think it’s part of what makes me a good teacher to people. Sometimes when an expert has been doing something for 10 or 20 years, they internalize all of these concepts, meaning, they get so used to it as they learn along the way. They forget that it’s something that most people don’t know. So when they try to explain it, they sneak in all of these confusing concepts.
Like if you’ve ever heard someone who’s technical (someone who knows how to code) talk about coding and try to explain it to you, and you’re confused within the first 10 or 15 seconds? It’s because they did their best trying to explain something that in their mind is pretty complicated, but they didn’t really take the time to think about what you know and what you don’t know.
Chris: And all the while, you’re thinking, “But this person is an expert in this. They know something I don’t know. I must be dumb.”
Mattan: Yeah, and I actually think it’s the opposite. I think if someone is not able to explain something complicated in a way that anyone can understand, then they’re actually not an expert in it.
Chris: I like that!
Mattan: They are kinda just living in their own ecosystem, sort of using the same buzzwords that they hear everyone else say. A lot of times, that kinda masks over a lack of understanding.
What made you want to learn how to code?
Mattan: Actually, I didn’t really start out thinking I was gonna learn how to code. I started out thinking I wanna build – I have this idea, and I wanna build it. So I went to my friend who I know had already built a company on his own, and I was like, “Help me build this.”
He said, “Wait. If you’re trying to build this, if you’re trying to find someone who can build it for you, or the magic solution to your problem, it doesn’t exist. But fortunately for you, you can learn how to code and build it yourself.”
I was like, “What are you talking about? I don’t have a degree in computer science. I’m not gonna take all this time to learn it.”
But he was like, “No, trust me. It’s easier than you think.” And then he told me his story. Basically, he was just working at a parking garage one summer, and he was bored out of his mind waiting and pulling cars in and out. Then, he had an idea just like I did, and a friend recommended a book to him. So he read the book, and he built this thing. And actually, in three months, he was like, “Oh, shit, I learned how to code.”
Chris: Did he learn to code from a book?
Mattan: Yeah, exactly. Fortunately, he didn’t recommend a book to me, because I’m allergic to books, at least I was at the time. I’ve sort of come around, especially into coding books because it’s become more interesting to me intrinsically. But when I first started out, the only reason why I was actually able to pick it up and follow along is ’cause I was watching videos, videos of people going through it, and walking me through it.
Did you use YouTube, or online coding courses to learn to code?
Mattan: I started with Lynda. It was basically a week-long class. It was about a set of 15 videos, and it was pretty good, after going through it, I was like, I did what they said, but I still have no idea how to go off on my own and do something.
Chris: Was learning to code with Lynda helpful?
Mattan: Learning with Lynda was definitely better than nothing. I got through it, and that was my initial goal – to just not give up.
Along the way, I got through it, but I was still kinda confused. I think when you’re learning something, this is this process you follow, right? You’re a kid, you copy people. You do what they do, and you don’t understand why you’re doing it, but maybe you start to figure out that, oh, you do this thing, and you get this result, right?
You know how kids will pretend to clean up around the house with a vacuum cleaner, or pick up the phone and call people, and they’re not talking to anyone, but they’re just going through the steps. They don’t understand the world. They don’t understand what they’re doing. But you do that enough, and eventually, you start to realize, oh, when I do this, this thing happens. I get it now. But I think sometimes, the doing it part has to come first instead of trying to understand everything.
I’m thinking of it as a mental map of how things are ordered. It’s sorta like a physical map of geography when you’re trying to get somewhere. There are many ways to start. I think you just don’t have this map in your head of where to, that’s how it lands for me. Right, and there’s the conceptual understanding. We all strive to really get why things work, and why they happen in a certain way.
Coding is kinda similar, where I could tell you all the concepts of this is a variable, this is how you do this. If you just watch me code, and I explain it to you, you’ll be like, “oh, I get it.”
But until you’ve actually just done it a bunch of times, until you’ve created a variable a hundred times, or until you’ve had to do a hundred loops, you don’t really get it.
What other resources did you use to learn to code?
Mattan: I also went through this online book called the Rails Tutorial. And then I was like, I think I’m starting to get it, but I’m gonna do another intro class. Then I did Stanford’s Intro to Programming online on iTunes U class. And by that point, I was like, okay, I think I get it.
Chris: This is fascinating. It sounds like you just mentioned three resources that you used. Did you just kinda do one after another? Was it on the same topic, or was it different? Was it all just Ruby on Rails, or was it different?
Mattan: It was all Ruby on Rails, because that’s what my friend, John, had been like, “Here’s what you should learn.” And so I didn’t wanna go off in all sorts of different directions, ’cause I felt like if I tried to learn three different languages, then I’m not really learning any one of them.
Chris: That makes sense.
Mattan: Yeah, it does. And I don’t necessarily think that they were one after the other. I think I did the first one, and I kinda took a pause for a few weeks, and then I was like, okay, I’ve kinda lost everything. Let me learn another one to refresh myself. And it came back pretty quickly. I think the third one I did was pretty close after that. But it was like about a month’s worth of stuff. Not like every day, nine to five, or anything, but maybe 1/2 an hour, or an hour a day, or a little more, a little less than that depending on what was going on.
How long did it take you to learn how to code?
Mattan: Yeah, so this is a funny question, ’cause I think what it means to know how to code is actually a broad thing. So you get a computer science degree, you study for four years. Do you know how to code? Yeah, probably, I think most people would say that a computer science major knows how to code. But if you ask them, build me a website, they might not actually know how to do that, right?
‘Cause maybe they never learned how to set up a website on the web, how to buy a domain name, how to do all these things. Could they figure it out? Probably. Are they gonna figure it out on their own or maybe they can ask a friend who has done it before? These are all different kinds of solutions to problems, like technical problems. The fact that they could figure it out in a reasonable amount of time, I think that’s what we think of as knowing how to code, right? Knowing how to solve a technical problem using code, or using technical solutions within a reasonable amount of time, right?
Now take my students who take the One Month Python class or who graduated from Columbia Business School, most of them finishing the class would say that I’m not a coder. I don’t know how to code. I’ve just had experience reading and writing some code. I’ve gotten to solve some challenges. But I don’t feel comfortable enough calling myself a coder. And I’m not gonna apply for programming jobs. And whatever, that’s maybe reasonable. Maybe you don’t wanna do that.
But then I would ask them, “Let’s say I gave you a challenge, “a problem you didn’t know how to solve, right? And you had an unlimited amount of time, do you think you could eventually figure out how to do it?” And their answer would probably be like, “Yeah, I’d probably ask someone, or I’d google it, and go through all the different resources, and figure it out.”
I’m like, “Well, if you can do that, then there’s nothing really separating you from a coder, right? The coder can do it, you can do it. It’s just a matter of how long it takes you to do it, right?” So maybe if I said, okay, your goal is to build a website, and you have a year to get a website live. You could figure it out if that’s all the time in the world. And maybe a coder can do it in a week, right? Or if you’re really good, a day.
However, even within professional coders, there’s such a big range. There’s some who can solve pretty complex tasks very quickly depending on what they’re good at. There’s somewhere it could still take them a while. So it’s just a matter of shortening the amount of time that it takes you to solve a problem, right?
So the real answer to that question, I think, and the questions like, how long does it take someone to learn how to code, is really when do you feel comfortable with coding? When do you feel like you feel good calling yourself a coder? You don’t feel like you’re lying to people. Or you feel like when you solve a problem, you actually understand why the solution’s working, as opposed to you just trying something and it worked.
How much time did it take you to finally say, “I can do this! I’m a coder.”?
Mattan: I’d say around six months. I think that point is gonna change for people depending on what they’re doing and how they’re using it for their job. For me, it was definitely when I learned how to code. Well, I did the guides, started teaching coding classes and wouldn’t even necessarily call myself a good coder at that point, or say I knew how to code.
Chris: This is when we were both teaching at General Assembly?
Mattan: Yeah, General Assembly, and the Skillshare class. And then I built the website, right? It was onemonthrails.com. And it was there that we started doing these PDF and certificates of completions for people. Then I built a login page, so they can log in and access lessons and added Stripe for credit card processing so that people could put in their credit cards, sign up, and take the class. And that was when I finally was like, “oh, shit, this is serious now” – not quite “I am a coder,” but I was like, “if things fail, it’s my fault”
Chris: Is that because there was nobody else?
Mattan: Yeah. It was like, it was just me. I could lose stuff, I could mess it up. They’re paying me money like it should be working. It was that pressure to own a project of my own that eventually led me to be like, oh, yeah, I can do this. But it was like building the confidence to put myself in this kinda scary situation, to be honest, I didn’t feel like I was suited for it, and then proving that I could do it. That’s when I said, “okay, I think I could call myself a coder now.”
If somebody wants to learn Python or learn to code in general, what would be your advice for a ‘small win’, like what type of project should they build first?
Mattan: Yeah, I think the hardest part is when you’re just getting started and you don’t know the relative difficulty of the project that you have in mind. You might have an idea for a really cool app you wanna build or website you wanna build, but you don’t know if that is a really hard or easy task or how long it is gonna take me. ‘Cause my advice used to be like, pick a project, and work on it.
I have had people come to me with projects, and I’d be like, “That sounds really hard. That could take a team of five people years to build.” I think it’s great that people are inspired, and have creativity, and wanna do something, but my usual advice there is – think through the problem, come up with a plan of attack, slim down the idea in the realm of lean startups and minimum viable products, figure out the MVP (Minimum Viable Product) of the thing you wanna build, and tackle that tiny, little piece of it. At least because it’s something you can hopefully chip off in a short amount of time.
How do you know what the Minimum Viable Product is? It’s hard to know that until you start learning. So, I think the process actually kinda feeds into itself. What I would say is – it’s okay to go into it with an idea in mind. Or if some cool idea pops up as you’re going through it, keep that in mind. But when you finish a class, or a tutorial, or something, keep track of those things you can use to do something else similar to what you’re doing. Push your boundaries a little bit in different directions, but be sure that you’re still kind of doing what they’re doing.
So my example is this. When I was first learning, I read the Ruby on Rails tutorial, which basically has you build Twitter using Ruby on Rails, right? So you’re copying something that you already know about. I didn’t go and then say, “okay, now I’m gonna try to build the Uber app, ’cause it’s a totally very different thing. I started by being like, okay, well, Twitter, if I take out tweets, and replace it with videos, it’s basically like I could put classes there. So I was sorta pushing the bounds of what I knew.” You picture the Twitter, and the way the interface works, and you have tweets of text. But instead of text, it was another image, or a video.
So as I was going, I was coming up with these ideas, but thinking, okay, I think I know how to do 90% of what I wanna do based on what I’ve learned. And there’s the 10% that I still have to figure out. So it’s like biting off something that you can chew, as opposed to trying to do something where you have no idea how to even get started. If you try that extra 10% you don’t know how to do, and it beats you down, just try something different. Don’t be married to the idea.
‘Cause honestly, it could turn out to be really easy or really hard, you don’t really know. You could talk to a friend or get some advice. That’s always a good way to figure out the relative difficulty of something. Talk to other technical people and hopefully as you learn, you have the opportunity to get exposure to people who know more than you do. Then think about how you would build your network.
Learning is a great way to do that, because people do really wanna help out. Every coder has relied on other people that they didn’t know before, and now they’re really grateful for those people. So they wanna pass it, pay it forward. All you have to do is be genuine and sincere, don’t annoy them, but make a connection, they’ll wanna help you. You can meet those people at meetups. Or even if you don’t, you could post it on Facebook or on Reddit forums, Hacker News, Slack or play, and other sites where people are.
Where do you meet developers? Meetups?
Mattan: Yes, there’s the Python Hacker Hours meetup where there’s just tons going on. Even if you don’t live in a city where there are meetups, there are online communities, too, where people are willing to help.
What is the best programming language for a beginner to learn?
Mattan: On one hand, my answer is, don’t worry too much about it, because I started with Ruby, and then I learned Python, and it was pretty easy for me to learn Python. It took literally two months for me to figure it out, because part of learning coding is you’re learning the building blocks of how computers work. You’re learning about what a variable is, and how to do a loop. And even though the ways that you do them are a little different in each language,the real thing that you’re learning is just the building blocks.
When you know it in one language, you’re just like, “okay, here’s how you do this in the other language.” So that’s why it’s not that big of a concern to be like, “oh, shit, what if I learn the wrong one?” But in terms of demand, I would say, Python is really good, because it’s the data science and data analysis and programming language of choice.
That’s because most of the major data science tools or plugins that other people have created and put out there into the world to make it easier for you to do stuff like statistics, or analyze large data sets or graph it, they’ve been built in Python. There’s a longer, complicated reason for that. It’s actually kinda interesting. When Google first started out, they wrote their scraper, the thing that went across the web, and figured out what the internet looked like, they used Python for that.
Chris: So, Google is built using Python?
Mattan: Yeah, Larry and Sergey wrote it in Python. And if you look at their white paper from the early ’90s, they show the Python code that they use. I have no idea where they stumbled on Python. It was of young language, and who knows how they figured that out? But they used Python. Then, when Google started to become a popular startup and started to grow, they hired the guy who invented Python to work at Google.
They had the whole concept of 20% time, and were like, you can spend 20% of your time just working on anything you want to, right? You can keep working on Python, you can build tools for data science, whatever you want. Well, they told him and everyone that joined their company.
The reason they hired him was because they wanted all the smartest people who wanted to learn Python to work at Google. So it was like their inflow of the smartest developers from all these computer science programs. It was a really smart business decision.
So, that is the same way that you hit critical mass. Like,Los Angeles starts by being this tiny, little entertainment hub, because the weather’s good, and they don’t have to cancel shoots, or whatever, so people move there. However, at a certain point, it becomes the place you have to be if you wanna work in entertainment. It’s the same for coding and data science.
So, you wanna be at Google ’cause he’s there, and you wanna work, and do data analysis, so you use Python, because all the biggest machine learning functions are built using Python.
Natural language processing for analyzing text, and getting the sentiment – positive or negative, is built in Python. One of the reasons I think Python is a really good place to go is that, right now, there happens to be a lot of work in data analysis.
This is something that’s actually relatively easy for a beginner to get into because you don’t necessarily have to work in a big team of tens or hundreds of people. You can be on your own with Python analyzing data. It is more like a solo thing, generally. It’s part of the reason why it’s become one of the fastest-growing languages, and one of the most in-demand languages. So it’s a good place to start.
I also just have my own personal allegiance to Ruby on Rails. If you wanna build websites, I think that’s a great option, especially any kinda website where you got members that sign up as users and do things on the website. I don’t think Python is necessarily the best option for that. However, it’s just a question of maybe there are slight advantages here or there for some languages to some applications. On the whole, though, I think Python’s a great starting point, to be honest.
What is the best way to learn Python?
Mattan: I mean there’s a lot of Python resources. One Month’s Python course is the course I teach! I obviously think it’s wonderful.
The one I typically send people to is called Learn Python the Hard Way. It’s not free, though. It’s like $29, so it’s relatively cheap.
Chris: Learn Python the Hard Way sounds difficult [because of the name], but it just means do it step by step, and really dive into it. Plus, Zed Shaw is just a great teacher. [Another great book is] Automate the Boring Stuff with Python. I believe there’s an online website as well [for that]. The book is fun because it’s less about the basics of Python, and more about the cool stuff you can do with Python, like how you can use it to automate the pretty tedious things that you might be working on in your job.
There’s also The Data Science Handbook, written for Python. It’s a book, but it’s totally available online for free, also. So usually, if you really wanna learn about data science, that’s a good third step to go. And then there’s all these online resources, does Codecademy still have free Python lessons?
Chris: I think so, but sometimes, when I go and send people there, there’s a pop-up now, and they want your email, and I think they have a Pro version. It’s a little bit confusing. I don’t know, do you find that that’s helpful?
Mattan: I find that those are good, not as a way to learn, but as a way to practice while you’re learning. There are Drills, but it’s not so much like a course. There’s HackerRank, a site with really good practice drills. And Exercism is another one. But, in terms of learning, I feel like Automate the Boring Stuff with Python and Learn Python the Hard Way are two good starting points.
Ready to learn Python? You can join Mattan at One Month where we offer a 30-day online coding bootcamp. The course is for absolute beginners and it’s one of the best ways to learn Python. Find out more at One Month.