Python is a high-level, interactive and object-oriented programming language. Its simple syntax makes it a great choice for a first programming language for a beginner.
No tutorial is good for everyone. This one is aimed at people with no programming experience at all. If you have programmed in the past with some other language you probably want to read the official tutorial instead. Like most other tutorials, this tutorial starts with math. You can skip that if you hate math.
This tutorial uses Python 3. Python 2 is not under active development anymore, and more and more projects are moving to Python 3. Currently there are a few packages that don't support Python 3 that well at the time of writing this (such as twisted), but if you haven't programmed yet Python 3 is a great choice.
This tutorial includes lots of footnotes [*]. They are for people who want to know more about something in more detail and for people who would otherwise complain about how my tutorial is wrong about some things. There's often links to awesome resources such as tutorials and videos. If you've finished reading my tutorial and doing the exercises I recommend reading the footnotes and other places they point to.
[*] Footnotes are like this.
To learn as much as possible from this tutorial, I recommend following these steps for all code examples in this tutorial. However, it's OK to skip these if you fully understand the example.
- Read the example and try it out yourself.
- If you don't fully understand why the example works like it does, read the explanation for it. Of course, you can read it anyway :)
- Modify the example to do something else than it does.
Most importantly, when learning a programming language you need to experiment fearlessly and try new things that you did not read from a tutorial. It's almost impossible to break your computer accidentally with Python. 99% of the time typing something wrong will simply make an error message that tells you what's wrong, it will not destroy anything.
Here's a list of chapters in this tutorial:
- Installing Python and using it as a calculator
- Strings, variables, Booleans and None
- Using functions and storing code in files
- If, elif, else and while
This tutorial is not officially licensed yet, but you are free to read, download and distribute it with or without modifications if you include this notice with your copy. If you have a suggestion for license or other suggestions, please help us improve this tutorial by making an issue about your suggestion.
I'm Akuli and I have written most of this tutorial, but the following people have helped me with it:
- SpiritualForest: Lots of typing error fixes.
- theelous3: Small improvements and fixes.