Basic programming can take months/years to get comfortable with (unless you take to programming like fish in water). Many a times, you'll need to go through lessons again and again. Programming requires hands-on experience too — I'd recommend to manually follow along the examples on your computer, don't just read/watch them. As an analogy, can you learn to drive a car by reading about it and watching videos? How about physical fitness exercises, can you achieve that by reading? I'd also highly recommend reading this article: How to teach yourself hard things.
Solving practice problems is very useful to review your understanding. After familiarizing with basics, doing your own project is highly recommended. If you get stuck, you can search online/documentation/books for those specific problems, and if that fails, you can ask for help on forums.
New to programmingBooks:
Interactive websites:
If you feel comfortable with programming basics and Python syntax, then exercises are a good way to test your knowledge. The resource you used to learn Python will typically have some sort of exercises, so those would be ideal as a first choice. I'd also suggest using the below resources to improve your skills. If you get stuck, reread the material related to those topics, search online, ask for clarifications, etc — in short, make an effort to solve it. It is okay to skip some troublesome problems (and come back to it later if you have the time), but you should be able to solve most of the beginner problems. Maintaining notes will help too, especially for common mistakes.
Once you are comfortable with basics and syntax, the next step is projects. I wrote a 10-line program that solved a common problem for me — adding body { text-align: justify }
to epub
files that are not justify aligned. I didn't know that this line would help beforehand. Found a solution online and then automated the process of unzipping epub
, adding the line and then packing it again. That will likely need you to lookup documentation and go through some stackoverflow Q&A as well. And once you have written the solution and use it regularly, you'll likely encounter corner cases and features to be added. I feel this is a great way to learn and understand programming.
These days, I use a better EPUB reader that allows me to customize alignments. Here's another real world example. I'm on Linux and use the terminal for many things. I wanted a CLI tool to do simple calculations. There's bc
command, but it doesn't accept direct string argument and you need to set scale
and so on. So, I looked up how to write a CLI tool in Python and wrote one using the built-in argparse
module that works for my particular use cases.
See also:
Knowing how to debug your programs is crucial and should be ideally taught right from the beginning instead of a chapter at the end of the book. Think Python is an awesome example for such a resource material.
Sites like Pythontutor allow you to visually debug a program — you can execute a program step by step and see the current value of variables. Similar feature is typically provided by IDEs like Pycharm and Thonny. Under the hood, these visualizations are using the pdb module. See also this pdb tutorial.
Debugging is often a frustrating experience. Taking a break helps (and sometimes I have found/solved the problem in my dreams). Try to reduce the code as much as possible so that you are left with minimal code necessary to reproduce the issue. Talking about the problem to a friend/colleague/inanimate-objects/etc can help too — known as Rubber duck debugging. I have often found the issue while formulating a question to be asked on forums like stackoverflow/reddit because writing down your problem is another way to bring clarity than just having a vague idea in your mind. Here's some more articles on this challenging topic:
Here's a summarized snippet from a collection of interesting bug stories:
A jpeg parser choked whenever the CEO came into the room, because he always had a shirt with a square pattern on it, which triggered some special case of contrast and block boundary algorithms.
See also this curated list of absurd software bug stories.
Tools, IDE and Text EditorsMaintaining your own cheatsheet as you learn is recommended, which you can complement with these resources.
The offical Python website has an extensive documentation located at https://docs.python.org/3/. This site has a search functionality, includes a tutorial, several guides for specific modules like re
, argparse
and various other information.
If you get stuck with a problem, there are several ways to get it resolved. For example:
You can also ask for help on forums. Make sure to read the instructions provided by the respective forums before asking a question. See also how to ask good questions. Here are some forums you can use:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4