In this brief introduction to programming you have seen the fundamental building blocks that almost every programming language provides:
- variables and assignment (
=) to store and update data
- arithmetic operators (
- simple data types (strings and numbers, both integers and floating point)
- data structures (lists)
- sequence (one instruction per line)
- iteration (
- selection (
- comparisons (
- functions (
floatto convert strings to numbers)
- input from the keyboard (
- output to the screen (
Programming languages have to be automatically understood by a machine, so the syntax and grammar are much more constrained than English and other natural languages. Any spelling mistake, like writing
flat instead of
float or forgetting punctuation like commas and colons, or using the wrong data type, leads to an error.
You have also seen that programming involves writing clear and understandable code (e.g. by using comments and plain English names for variables and functions) to make it easier to change later, and testing it thoroughly.
Learning to program forces us to think clearly and rigorously when solving a problem, because the solution has to be described in very small and precise steps that even a machine can understand. Python makes it easy to write the code once we come up with a sufficiently detailed algorithm, but the thinking (still) has to be done by us.
Like learning any other skill, only practice makes perfect. We hope this tutorial inspired you to learn more Python and to share your creations with friends and family.