1. Dive into the basics
You’d think the Python website itself would contain a good tutorial like most other languages do. However, they mostly link to other sites or dive in deep, assuming you are a seasoned programmer already.
Python Land offers a free and easy to follow introduction to the language, with topics like:
- Python’s history (the language is actually quite old!)
- Installation instructions
- A beginner's tutorial to Python covering basics like variables, functions, for-loops, etcetera
If you prefer videos, there are many high-quality and free courses on YouTube. Just use the search function and watch some of the more popular ones to find something (and someone) to your taste.
You’ll have to get your hands out of your pockets and start experimenting and coding yourself
Unfortunately, you don’t become a programmer by just reading or watching movies, just like you won’t become a carpenter by just reading about it. You’ll have to get your hands out of your pockets and start experimenting and coding yourself. If you ask me, there’s no better way to start experimenting than using the Python REPL.
2. Use the REPL — All the time!
The Python REPL is awesome. It’s an interactive environment in which you can use and try the language. REPL is an abbreviation for:
- Read: Python reads your command
- Evaluate: Python evaluates the input
- Print: it prints out the result
- Loop: and it’s ready for the next input
It allows you to try stuff quickly. Some examples of what you can do:
- Enter simple commands, like
- Enter complete functions or even classes
- Import and use libraries
Basically, you can do everything Python can, but interactively. And because it’s so interactive, you directly see the results. Thanks to auto-complete, it will even help you find the right methods without looking up the documentation. And thanks to the
help() function, can explore further without opening a manual or google.
3. Ask for help()
That’s right. You don’t need to google everything, and often, you don’t need to ask others either. All the core Python libraries have so-called docstrings included.
Quoting from PEP-0257:
“A docstring is a string literal that occurs as the first statement in a module, function, class, or method definition. Such a docstring becomes the __doc__ special attribute of that object.”
Basically, most documentation is included with the code. And since Python is not compiled but interpreted, it’s easy to pull up this documentation.
Python has one convenient built-in function to use these to your advantage. In the REPL, you can view a docstring, and more, with:
Just try it, and you’ll see a nicely formatted and scrollable document about Strings, including the docstring, plus the available methods and their descriptions.
In this list, you’ll also see the so-called “dunder methods.” They start and end with double underscores, like
__add__(self, value, /) . If you’re a beginner, ignore them for now.
4. Ask for help (from a human, this time)
Sometimes, you need a little guidance from a fellow programmer. Before you ask a question, please read these tips. They will benefit you and the ones you ask.
Developers have the reputation to get a little cranky when asking questions that you could have found the answer to with a simple google search. Always start with extensively trying to find an answer in other ways. Before you ask a question:
- Read the documentation — also called RTFM, short for “read the f***ing manual.”
- Search Google for the answer if the documentation is not clear enough or does not solve your problem.
This should solve about 80% of your questions — seriously. And you’re still stuck, consider where to ask for help first:
- A bug tracker is not the place to ask questions that are not about (potential) bugs.
- A developer mailing group is intended for developers working on the product, not developers using the product.
- Many projects have a page instructing you how and where to ask questions. Look for such a page.
- There are large Facebook groups dedicated to Python programming. I’ve also seen several Telegram groups about Python. In my experience, they can be messy and have a lot of noise, but often you’ll get your answer, so it’s worth checking those out.
Finally, before writing down your question, take these points in mind:
- Be kind, be grateful. The people that answer you and try to help you often do so in their spare time, for free.
- Be as detailed as possible. Provide context: what are you working on, why, what have you tried so far?
- Include error messages, (parts of) log files, and the code giving the problem. Don’t dump entire files. Only include what is needed to get proper help.
- Making a screenshot instead of photographing your screen
In short, be respectful of other people’s time and effort.
5. Don’t procrastinate learning about classes and objects
Python is inherently object-oriented. Everything in Python is an object, even numbers and strings. It is best to learn about objects and classes early on because it will greatly increase your understanding of the language.
Believe me when I say you’ll reap the benefits of this very soon. Python Land has a large section on objects and classes in Python. It explains the concepts to beginners, but it also shows some of the inner workings to remove the ‘magic’ from the subject. Try it!
6. Build something — Anything!
The best way to learn is by building something. You can learn all the theory you want, follow all the tutorials you want, but you have to get started on a project at some point. Don’t beat yourself up, though. It doesn’t have to be perfect, and you can always start over and do better on the next try.
“But what should I build?!” Good question. If you can’t think of something yourself, try this article:
Thank you for reading, and good luck, you can do this! The hardest part is getting started, so get started right now!