5 approaches to learning Python

5 approaches to learning Python

Whatever your learning style, there’s a resource for learning Python designed just for you. Here are five popular options.

5 approaches to learning Python
Image by : 

opensource.com

Get the newsletter

Join the 85,000 open source advocates who receive our giveaway alerts and article roundups.

Python is a powerful, versatile programming language that's popular with open source software developers. Whether you're a seasoned developer looking to test your code, or you just want to learn the basics, the following resources might help.

1. Codecademy: The hands-on approach

Do you like a hands-on approach to learning? Try Codecademy. Codecademy courses include lessons, projects, and quizzes to help you learn Python and other coding languages. A free account grants access to interactive lessons and exercises, while a pro account also allows you to practice with quizzes and project challenges.

Each Codecademy lesson is completely interactive, and setup is painless. All the hard work—handling imports, packages, compiling, etc.—is done for you, so all you have to do is write the Python code. Lessons cover an array of topics in a variety of categories, including strings, functions, control flow, and loops.

Some users compare learning to program with Codecademy to learning to ride a bicycle with training wheels; however, when you’re a beginner, training wheels are essential. You may want to learn the simple syntax of a coding language before tackling complex topics like build processes and compilation.

2. Khan Academy: The lecture hall approach

Khan Academy is a video tutorial site with hundreds of videos on topics ranging from math to history to electrical engineering—and everything in between. If you prefer learning from lectures, this site might be great for you. Creating an account is free, but you don’t even need an account to watch videos on the site.

Khan Academy offers an “online class” feel, where an individual lectures in a series of videos. Each video describes one element of Python. You can then take the knowledge gained in each video and utilize it in your own code. For example, one video discusses for loops written in Python. For loops are a crucial control flow element used to specify iteration, so once you've learned about them, your Python code can greatly increase in complexity.

Unfortunately, when I was writing this article, the Khan Academy Python series was removed from the main website, but you can still find it on the Khan Academy YouTube channel.

3. Tutorialspoint: The textbook approach

Tutorialspoint is a gold mine of documentation, tutorials, and articles on any computer-related topic imaginable. (There are also resources for sports, monuments, and soft skills.) Essentially, if there is a computational topic you wish to learn, check Tutorialspoint. The website is free, requiring no login to view any of the content. If you prefer to learn by reading, this might be the best resource for you.

Tutorialspoint’s basic Python tutorial bypasses the training wheels placed by Codecademy and walks you through each step of setting up Python locally. After discussing installation and interpretation via command line, the tutorial progresses into the language itself. The first few pages cover basic syntax and variable types, but the advanced tutorial covers networking, XML processing, and multithreading.

Tutorialspoint is a great free resource for Python beginners as well as those who need a refresher or who want to learn about more complex topics.

4. GitHub: The exploratory approach

GitHub offers an exploratory approach to learning Python. This method may be best if you have experience in a coding language. GitHub is a centralized repository that anyone can use to house and maintain code, and it contains a plethora of Python projects that are available for exploration. Learning Python via GitHub would involve independent examination of existing Python projects.

From a simple search on the main page of GitHub, I found thousands of Python projects, ranging in skill level from beginner to expert. Some of these projects were specifically designed as examples for users interested in learning Python. Others were real projects written in Python, allowing for close inspection of real-world examples.

Two education-based projects belong to GitHub users Adaptives and Keon. The first of these two projects contains files showing simple examples such as defining different data types and raising exceptions. The second project is more advanced, providing Python implementations of many popular algorithms, such as the knapsack problem and different sorting algorithms.

Not all projects on GitHub are code-based. This constantly evolving guide provides a comprehensive overview of many Python concepts, from installation to debugging to writing documentation.

5. Python Tutor: The inspective approach

Python Tutor is a unique addition to this list. Once you have the basics of Python under your belt, this tool enables you to step through your code, line by line, to inspect variable values every step of the way. This is helpful for debugging, understanding how algorithms run from start to end, and preventing the perpetuation of incorrectly returning code. Once you’ve used the resources above, try out Python Tutor to better visualize the code you’ve written.

If you know of other online resources for learning Python, let us know in the comments below.

Topics

About the author

Sophie Polson - Sophie is a senior at Duke University studying computer science. She has just started to venture into the open source community via the course "Open Source World" taught at Duke in the fall of 2017, and has developed an interest in exploring DevOps. She will be working as a Software Engineer following her graduation in the spring of 2018.