Skip to content

Why Python?

Why Python?

You might be wondering "Why should I solve problems with Python?" There are other programming languages in the world such as MATLAB, LabView, C++ and Java. What makes Python useful for solving problems?

Python is a powerful programming language

Python defines the types of objects you build into your code. Unlike some other languages such as C, you do not need to declare the object type. The object type is also mutable, you can change the type of object easily and on the fly. There is a wide array of object types built into Python. Objects can change in size. Python objects can also contain mixed data types. Strings and floating point numbers can be part of the same list.

Python has an extensive Standard Library. A huge number of object types, functions and methods are available for use without importing any external modules. These include math functions, list methods, and calls to a computer's system. There is a lot that can be done with the Python Standard Library. The first couple of chapters of this book will just use the standard library. It can do a lot.

Python has over 100,000 external packages available for download and use. They are easy to install off of the Python Package Index, commonly called PyPI ("pie pee eye"). There is a Python package for just about everything. There are packages which can help you: interact with the web, make complex computations, calculate unit conversions, plot data, work with .csv, .xls, and .pdf files, manipulate images and video, read data from sensors and test equipment, train machine learning algorithms, design web apps, work with GIS data, work with astronautical data. There are and many more Python packages added to PyPI every day. In this book, we will use some of the more useful Python packages for problem solvers such as NumPy, Matplotlib, and SymPy.

Python is easy to learn and use

One way Problem solvers code solutions faster in Python faster than coding solutions in other programming languages is that Python is easy to learn and use. Python programs tend to be shorter and quicker to write than a program which completes a similar function in another languages. In the rapid design, prototype, test, iterate cycle programming solutions in Python can be written and tested quickly. Python is also an easy language for fellow problem solvers on your team to learn. Python's language syntax is also quite human readable. While programmers can become preoccupied with a program's runtime, it is development time that takes the longest.

Python is transportable

Python can be installed and run on each of the three major operating systems: Windows, Mac and Linux. On Mac and Linux Python comes installed out of the box. Just open up a terminal in on a MacOS or Linux machine and type python. That's it, you are now using Python. On Windows, I recommend downloading and installing the Anaconda distribution of Python. The Anaconda distribution of Python is free and can be installed on all three major operating systems.

Python is free

Some computer languages used for problem solving such as MATLAB and LabView cost money to download and install. Python is free to download and use. Python is also open source and individuals are free to modify, contribute to, and propose improvements to Python. All of the packages available on the Python Package Index are free to download and install. Many more packages, scripts and utilities can be found in open source code repositories on GitHub and BitBucket.

Python is growing

Python is growing in popularity. Python is particularly growing in the data sciences and in use with GIS systems, physical modeling, machine learning and computer vision. These are growing team problem-solving areas for engineers.