1.3.1. Introduction to Python#

Python is a general-purpose, high-level programming language. It is very popular.

Our first set of readings, from Computational and Inferential Thinking [ADW21], introduce the first programming concepts and how one does them in python.

Reading Question

  • What is the difference between 2, "2", two, and "two"?

Our second set of readings is also from Computational and Inferential Thinking [ADW21], and introduces sequence and table data types. The examples here use the python datascience library, which was created for the DATA 8 The Foundations of Data Science course at the University of California at Berkeley.

The datascience package is an open source Python package that helps make programming more accessible to all students, regardless of background. As a pedagogical aid, the package is designed to help students more intuitively conduct data science techniques without first spending considerable time directly learning more complex tools such as pandas or matplotlib. At Berkeley, these other packages are introduced in further upper-division coursework such as Data 100.

source

If you want to try the examples in these readings, first do

from datascience import *

Reading Question

  • How would you use np.arange to create array([ 1.5,  1. ,  0.5,  0. , -0.5])?