lang | syntax | title | author |
---|---|---|---|
Python |
python |
Python is an interpreted high-level general-purpose programming language. |
AaquibAli |
print("hello world")
Python is a high-level programming language designed to be easy to read and simple to implement. It is open source, which means it is free to use, even for commercial applications. Python can run on Mac, Windows, and Unix systems and has also been ported to Java and .NET virtual machines.
Python is considered a scripting language, like Ruby or Perl and is often used for creating Web applications and dynamic Web content. It is also supported by a number of 2D and 3D imaging programs, enabling users to create custom plug-ins and extensions with Python. Examples of applications that support a Python API include GIMP, Inkscape, Blender, and Autodesk Maya.
Scripts written in Python (.PY files) can be parsed and run immediately. They can also be saved as a compiled programs (.PYC files), which are often used as programming modules that can be referenced by other Python programs.
According to the TIOBE index, which measures the popularity of programming languages, Python is the third most popular programming language in the world, behind only Java and C.
There are many reasons for the ubiquity of Python, including :
-
Easy to Learn and Use
-
Mature and Supportive Python Community
-
Support from Renowned Corporate Sponsors
-
Hundreds of Python Libraries and Frameworks
-
Versatility, Efficiency, Reliability, and Speed
-
Big data, Machine Learning and Cloud Computing
-
First-choice Language
-
The Flexibility of Python Language
-
Use of python in academics
-
Automation
We got why Python is so popular
at the moment above, but why should one learn how to implement it? Aside from the ease of use and versatility mentioned above, there are several good reasons to learn Python:
-
Python developers are in demand : Across a wide range of fields, there is a demand for those with Python skills. If you’re looking to start or change your career, it could be a vital skill to help you.
-
It could lead to a well-paid career : Data suggests that the median annual salary for those with Python skills is around £65,000 in the UK (at present).
-
There will be many job opportunities : Given that Python can be used in many emerging technologies, such as AI, machine learning, and data analytics, it’s likely that it’s a future-proof skill. Learning Python now could benefit you across your career.
Clearly, Python is a popular and in-demand skill to learn. But what is python programming used for? We’ve already briefly touched on some of the areas it can be applied to, and we’ve expanded on these and more Python examples below.
- AI and machine learning
- Data analytics
- Data visualisation
- Programming applications
- Web development
- Game development
- Language development
- Finance
- SEO
- Design & more...
You are probably familiar with Windows as they are widely used throughout the world. The latest version of Windows is Windows 10. Generally, you should be on the latest version of the OS, but if you have an older machine or other software requires it, you might be stuck with Windows 7 or older. You should be fine with both, but be aware that if you want to use Python 3.5 or above, Windows XP is not supported.
If you go for Windows, there are some shell options for you. Windows comes with the Command line, but also Powershell. Powershell feels more like a normal terminal you would know from the Linux- or Mac world.
The Mac has a built-in terminal that works right out of the box. You can install variations, like iTerm if you like more flexibility, but the original does its job perfectly. Python comes pre-installed with macOS, but make sure you check the version so you are up to date.
Most text editors and IDEs work on macOS.
macOS, like Windows, is not Open source, but it comes with the machine. macOS only works on a Mac (officially) so you are tied down to Apple hardware.
One of the most important things you’ll do when working with any programming language is setup a development environment which allows you to execute the code you write. Without this, you will never be able to check your work and see if your website or application is free of syntax errors.
With Python, you also need something called an interpreter that converts your code – which makes up the entirety of your application – to something the computer can read and execute. Without this interpreter, you’ll have no way to run your code.
To convert your code, you must first use a Python shell, which calls upon the interpreter through something called a “bang” line.
As for creating an application or file, there are two ways to do this. You can create a program using a simple text editor like WordPad, or Notepad++. You can also create a program using a Python shell. There are advantages and disadvantages to each method, which we’ll discuss next.
A shell is a program or tool that can be used to interact with a system. For instance, the Windows operating system shell can be tapped into by using a “terminal” or command line to submit commands and arguments.
With Python, things work a bit differently than an operating system shell. The Python shell is used to interact with an interpreter, which feeds code to a computer in a form that it can understand.
When you execute a Python program that you’ve written, the interpreter reads the code and converts it into usable commands. The important thing to note is that all of this is done after the program has been executed.
With a shell, the interpreting – or conversion – happens in real-time as you type the code into the computer or system. This means that the actual program is executing as you type. This gives you some idea of how your final code will look, and what your program is actually going to do.
When you write code in a text file, none of that happens until you feed the document into an interpreter. If you have Python installed on your computer you can call upon the interpreter using a command line, but this step is done after you’ve already written the code.
This makes it more difficult to spot errors in your code, and it can also be frustrating if the interpreter runs into issues, because they may not be as apparent as they would if you had used a shell. Still, a lot of developers prefer to use a text editing tool because it is simple and easy to do.
There are text editors with increased functionality – like Notepad++ – which were specifically developed with programming in mind.
Before you can do anything with a programming language, you first need to configure the development environment. Now, we’re going to cover how to set up Python and the interpreter that will execute your custom programs.
Python comes pre-installed on Mac and a majority of Linux distributions. However, you may need to download an updated version depending on how old your system is.
TIP: You can easily check your Python version by opening the terminal and running the following command:
python --version
If you’re running Windows, you’ll need to download Python from the Python Software Foundation (link below).
If you need to download Python, the best place to go is the official site. You’ll need to download the version specific to your operating system and processor (32 or 64 bit).
Mac: Most Mac OS X computers already have Python 2.x installed, which is perfectly fine to use. The best way to install the latest version is to use Homebrew to activate and manage them. You’ll find instructions on how to do that here. You can also download Python directly from the PSF if you prefer.
Linux: Python is included with most distributions of Linux. Check your current version and be sure to upgrade using the package manager, if necessary.
Windows: Just download Python from the PSF.
TIP: If you’re using Windows, be sure to select the option that adds Python.exe to your system path during installation. You can do this by selecting the option next to “Add python.exe to path,” and then choosing your local hard drive as the install location.
⚙️ Which Version Should I Use?
Long story short, it’s entirely up to you which version of Python you use! There’s no right or wrong answer, and it’s painless to make the jump from one version to another should you realize you need to do so later on.
-
Visual Studio Code by Microsoft
-
Sublime Text by Jon Skinner
-
Atom by GitHub
-
PyCharm by JetBrains
-
scikit-learn : scikit-learn is a Python module for machine learning built on top of SciPy and distributed under the 3-Clause BSD license.
-
Google Images Download : This is a command line python program to search keywords/key-phrases on Google Images and optionally download images to your computer.
-
Youtube-dl : download videos from youtube or other video platforms.
-
System Design Primer : This repo is an organized collection of resources to help you learn how to build systems at scale.
-
Face Recognition : Recognize and manipulate faces from Python or from the command line with the world’s simplest face recognition library.
-
snallygaster : Tool to scan for secret files on HTTP servers.
-
Cookiecutter : A command-line utility that creates projects from cookiecutters (project templates)
That concludes our look at what Python programming can be used for. As you can see, there are many applications for this popular language, with a wide support network and a diverse range of libraries that can help.
There are many reasons why you might want to start learning Python. It’s a future-proof and in-demand skill that’s required across all kinds of industries. What’s more, we have a broad selection of Python courses that can help you either master the basics or develop some more specific skills.