How to Learn Python: Where to start and how to stay with it
If you’re thinking about learning a new programming language, in the very near future, you’re going to be outputting that phrase, “Hello World”, to your screen. It’s guaranteed. It’s like a rite of a passage. A modern day tradition of all learners in all programming languages. Displaying information to your users is a fundamental part of any application that you’ll ever build.
You have to start your learning somewhere — ideally, from a place that makes no prerequisites and no assumptions about what you already know about the language you’re studying. You want to be present and able to focus on what you are being taught in the moment, with no uneasy sense that you’ve missed something important. You don’t want to stop your lesson to go search other sources to fill the possible gap in your knowledge.
If you are thinking about learning Python, you’re onto something. That’s a wonderful idea.
Python is a popular first language choice, as it was designed from its very beginning to be easy to read. It’s a general purpose scripting language, so you’ll find it used in all sorts of fields and many different types of applications:
- The US Government uses Python to do statistical analysis and data visualizations.
- Spotify, Evernote and OkCupid rely on Python for personalized recommendations and other artificial intelligence based tasks.
- Snapchat makes those silly filters by using Python for facial recognition
- Disney, Pixar, LucasFilm and others use Python to provide more realistic effects in their movies.
- Large familiar websites like YouTube, Instagram, Reddit, Pinterest and even the Onion lean on Python.
You can use Python for face and speech recognition, you can control robots and shoot lasers, send an email when your doorbell rings, and just about anything you can imagine.
It has seen a lot of growth in this decade and its popularity is continuing to soar. This makes learning the language both exciting and lucrative.
The Python community is supportive with a big focus on documentation and openness. There are tons of Python inspired conferences held internationally all year long. The Python Software Foundation, is a non-profit that has been formed to ensure that the language advances and the community grows in diverse ways. Community is a crucial part of embracing a language, and you’ve found a great one.
If you’re itching to say hello to the world, you can get started with pretty quick.
What you are seeing is known as the interactive Python shell. The shell allows you to explore and test out various bits of code. The >>> symbol there is waiting for you to write some Python so let’s do it.
Type out this instruction
|>>> print(“Hello, World”)|
Make sure you type that line exactly as it is written. Python is case sensitive, meaning print is different than Print. Press enter, and bam! Congratulations on completing your first line of working Python code.
Our line can be read as: Call the function named print, and pass it the string “Hello, World”.
Let’s break that description down a bit. Functions are a programming concept that allow you to group common instructions together under a given name. This encourages code reuse, and helps to avoid writing the same things over and over. The function named print is one of the many standard functions provided by Python. You can, and will very soon, create your own functions.
When you use a function, it is said to have been called. You call a function by placing opening and closing parentheses after the function name. Functions define what are known as parameters, which can be thought of as options that will make the function behave differently. The print function has been defined to accept a parameter. The value passed into that parameter, also known as an argument, will be the value that is to be outputted.
Now about that value … When we used those quotation marks we created what is known as a string. A string is a series of characters — you know letters, numbers and symbols — all combined. They are strung together like letters on a birthday banner.
The programs that you write in Python are called scripts. Think about these like a script for a play. You write instructions that you want the computer to perform and Python interprets the meaning and then performs, or executes, your script. You just wrote a single line script! It was wonderful.
There is a lot of terminology and concepts packed in that one line of code above, right? Don’t worry, it’ll all sink in if you just immerse yourself.
You can install Python locally on your computer and get yourself a nice coding environment. There are great detailed instructions on the Python Software Foundation’s Getting Started Guide.
Sticking With It
Getting started is definitely the biggest hurdle in learning, but a close runner up is the challenge of staying motivated. It’s important for you to be able to assess your new skills, so you can sense if you are accomplishing your goals and making progress. It’s important to make sure that you challenge yourself to ensure that the information you are taking in is sticking. There are coding exercises, sometimes called Katas, that will keep you practicing after you’ve picked up the skills. You definitely want to make sure you exercise your new coding muscles.
After you complete some learning, oftentimes it’s hard to know where to direct your focus next. There definitely is not a shortage of places to learn, but as a self-learner, you probably already know how difficult it can be to find the right course at exactly the right level. Sometimes there is too much assumed about your skills, and sometimes things are way too slow and repeat concepts you already comprehend. The same problem exists for those practice challenges — finding the right challenge or project for your current skill level can be difficult to locate. Don’t worry, you’ll find your place, just keep looking.
Okay, well maybe you don’t need to look too far. Pardon me for not introducing myself before, but I’m Craig and I’m a teacher here at Treehouse. We have full time teachers who create content that covers concepts for absolute beginners to more advanced learners. We know what you’ve seen, we were there with you! Because of this, we’re able to speak with you in terminology that we know you understand.
We start from the very beginning, with no assumptions about your knowledge and definitely no prerequisites. You don’t even need to have anything installed on your computer. Our beginning content is all taught in our web-based environment Workspaces, so you can get started coding immediately. We want your experience to be focused and fun.
You don’t need to worry about what you should learn next — just join a Track and we’ll guide you. Tracks are comprehensive, well-curated ordered playlists of our content. When you complete a Track, we’ll give you options so you can decide what subject would best serve you and your goals to learn next. You just focus on what you are learning, and we take care of the rest.
We care deeply about your learning journey, so we work hard to ensure you start off strong and can stick with it. We understand that learning to code can seem daunting, so we pay close attention to the feedback from our students and apply their suggestions and ideas to our content as we refresh it. We’re also huge fans of learning science around here. That’s why we’re constantly experimenting and embedding the latest tools and findings in our content and application.
I realize that it might be obvious that a teacher at Treehouse would recommend our service, but even if I didn’t work here, I still would recommend us. I wholeheartedly believe in what we’re creating and I wish I had our courses when I was first learning to code. I think you’re gonna love it.
Retaining what you’ve learned
Ooh, I forgot to mention, we also have Code Challenges.
Code Challenges are interactive prompts that help guide you through our courses. Nothing is better than that “aha” moment that comes after solving a coding problem, and we’ve peppered them throughout our content. The struggle of completing a challenge is actually an important part of learning. It’s like muscle resistance training. No pain, no gain, for your brain.
We also have a wonderful Python community on Treehouse, a very beginner friendly and safe space to ask questions and a great way to stay motivated and learning. You can help assist fellow students with problems that they are stuck on. Nothing helps to cement your learning more than trying to explain a concept in your own words. It is definitely a win-win situation; your fellow student gains some of your knowledge and understanding, and organizing your thoughts to tutor them actually helps you retain and refine your own learning. Being able to help is a delightful feeling and a well earned benchmark of your progress.
I know you are excited to learn to code, but after you get started, it’s crucial that you remember to take breaks. Breaks allow the information to sink in. I’m also sure you have a busy schedule. That’s why we’ve set up each of our lessons to be in the 10 minute range. We want to fit into our students’ lifestyles. Learn at your own pace and don’t overdo it.
I’m excited that you are considering learning to code. It will change the way you look at the world, and the opportunities that will open up to you will be life changing. Hope to see you around!
If you still aren’t sure that the Treehouse Python content is for you, why don’t you give our free trial a spin. Hello, World indeed.
Front End Web Design
iOS Development with Swift
Python Web Development
Each is designed by our faculty of tech professionals to guide even a coding beginner to becoming a job-ready software developer armed with a professional portfolio of real-world projects. Try one out today with our free seven-day trial, and see if software development is for you.