Chapter Objectives
• To understand the main features of Python.
• To know about various integrated development environments of Python.
• To implement basic programming constructs using Python.
• To understand the usage of various data types like numbers, list, tuple, strings, set, and dictionary.
• To compare various data types like list, tuple, dictionary, and set.
• To use if and looping statements in Python.
• To define user-defined functions.
Today, Python is known to be one of the most in-demand programming languages. As per the stats of GitHub (a provider of Internet hosting for software development), Python is the second most popular programming language, following JavaScript, as shown in Figure 2.1, and soon it may be on the top of the chart. Python surpassed Java, PHP, and other prominent languages in 2019.
Python is easy and versatile. So it is acclaimed as the major programming language to work on many new-age technologies like machine learning (ML), artificial intelligence, data science, and natural language processing. The creator of Python, Guido van Rossum, in 1991, stated that Python is a high-level programming language, and its core design philosophy is about code readability and syntax, which allows programmers to express concepts in a few lines of code. Interestingly, the name Python is inspired by Guido's favorite television show Monty Python's Flying Circus.
In this chapter, we will discuss various programming constructs of Python so that you can easily implement ML algorithms by using it. Before writing the actual code in Python, let us focus on the features of Python that make it so popular and unique.
2.1 Features of Python
Features offered by Python can be visualized in Figure 2.2. Talking about them profoundly, the main features of Python are as follows:
• Beginner's Language: Python is not only just easy to code and learn, but also fast to grasp, and hence it is a suitable choice for any novice user who wants to learn to program. This is why nowadays this language is introduced to students in schools.
• Interpreted: Unlike other programming languages such as C or C++, Python does not require you to compile programs before executing them. It is an interpreted language, i.e., the code written in Python gets processed in real-time line by line.
• Interactive: The interactive feature of Python enables real-time feedback, allowing programmers to experiment, debug, and make adjustments on the go.
Review the options below to login to check your access.
Log in with your Cambridge Aspire website account to check access.
If you believe you should have access to this content, please contact your institutional librarian or consult our FAQ page for further information about accessing our content.