Learn to program with Python: much loved because it is short and easy to understand

Technology

From console scripting to statistics to neural networks, Python is popular. This is mainly due to the elegance and understandability of the code.

time of reading:

9 mins



In your pocket save to your computer


Moritz Reichartz

Moritz Reichartz

(Photo: Moritz Reichartz)


Programming is a mental challenge: every program is made up of building blocks that you have to piece together in your head like clockwork so that all the parts fit together perfectly in the end. Writing down the result of this thought process so that the computer can execute it is only the last step of this work. Above all, a programming language shouldn’t get in the way. Python is perfect for this because the language works in a procedural, functional or object-oriented way; just as you need it. Getting executable code fast is the most important goal, and Python sacrifices both data type checking and parenthesis checking. For example, the following line defines three variables in one step:

a, b, c = 5, "b", []

That a an integer, b a string and c are an empty list, Python recognizes them by their appearance. And you certainly haven’t swapped the values ​​of two variables that quickly:

a, b = b, a

In Java this would not have been possible in one line. In blocks of code as one for-loop Python saves both the semicolon and the parentheses:

To the home page

Leave a Reply

Your email address will not be published. Required fields are marked *