Chapter 2. Introduction to Python
Can you read this? If so, I have good news for you: you won’t have any trouble learning to program. Why? Because computer programming languages in general—and Python in particular—are much less complex than natural human languages. Programming languages are designed by humans to be read, for the most part, by computers, so they have simpler grammar and far fewer “parts of speech” than natural languages. So if you feel reasonably comfortable reading English—a language notorious for its large vocabulary and irregular spellings and pronunciation—rest assured that learning the fundamentals of Python is well within your reach.
By the end of this chapter, you’ll have all the Python skills you need to begin doing basic data wrangling with the common data formats that we’ll cover in Chapter 4. To get to that point, we’ll start by doing some basic coding exercises that cover the following:
-
Essential Python “parts of speech” and its basic grammar/syntax
-
How the computer reads and interprets your Python code
-
How to use code “recipes” that are built by others (and yourself!) to quickly expand what your own code can do
Throughout this chapter, you’ll find code snippets that illustrate each concept, which are also collected in the accompanying Jupyter notebooks and standalone Python files on GitHub; these can be pulled into Google Colab or downloaded and run on a computer. While these files will let you see this chapter’s code in action, however, I ...
Get Practical Python Data Wrangling and Data Quality now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.