Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
Why Learn Python
Python is a general purpose programming language. Created nearly 30 years ago, it is now one of the most popular language according to the TIOBE index. Its popularity is particularly important in the data science and machine learning fields. But it is also a language easy to learn, this explains why it has become the language the most taught in universities.
Python interpreters are available for the main operating systems (Linux, Mac OS, Windows, Android, iOS, BSD, etc.).
Python is easy to learn
Python has a simple syntax that makes it suitable for learning programming as a first language. The learning curve is smoother than other languages such as Java, which quickly requires learning about Object Oriented Programming or C/C++ that requires to understand pointers. Still, it's possible to learn about OOP or functional programming in Python when the time comes.
Python provides a well-furnished standard library and many external libraries are available. This allows to quickly develop concrete applications. Actually, developping a small project is a good way to stay motivated and keep learning!
What is python used for?
- Web Development, using the frameworks Django, Flask, Pylons
- Data Science and Visualization using Numpy, Pandas and Matplotlib
- Machine learning with Tensorflow and Scikit-learn
- Desktop applications with PyQt, Gtk, wxWidgets and many more
- Mobile applications using Kivy or BeeWare
- Education: Python is a great language to learn programming!
Python is a powerful language
- Python is an Object Oriented Programming language. It even allows you to create classes with multiple inheritance.
- Python offers the necessary features to allow you to program in functional programming: lambda, map, filter, reduce, partial...
- Python checks the type of the variables during runtime, this makes the declaration of variable easier. But it's also possible to do static typing to catch potential bugs sooner.
- Python has a very extensive standard library. It contains many types (lists, maps, sets, numerics, ...), it has IO functions to read/write files, mathematics functions (complex numbers, fractions, statistics functions, random...), compression (zlib, gzip, zip, ...), parsing (xml, csv, ...), cryptography, threads, sockets, http modules, graphical interface, and many more.
- More that 150,000 libraries are available using the package management tool pip.
What Python Looks Like
Common Data Types
A list is an ordered sequence of values.
A dictionary, commonly known as a hashmap or associative array, allows to associate a key to a value:
Conditionals and Loops
Here's an example of condition:
And here's a for-loop that prints all the divisors of 3575:
Python is an Object Oriented Programming language. Here's a simple example of a class:
Here's the source code of a small game where the player has to guess a random number:
Check out my other playgrounds: