Lab 1: Introduction to Python
Welcome to Lab 1! Each week you will complete a lab assignment like this one. In this lab, you'll get
started with the Python programming language through numbers, names, and expressions.
As you go, please regularly select
Save and Checkpoint
menu below the Jupyter logo
to save your work.
Quantitative information arises everywhere in data science. In addition to representing commands to
print out lines, expressions can represent numbers and methods of combining numbers. The expression
evaluates to the number 3.25. (Run the cell and see.)
Notice that we didn't have to
. When you run a notebook cell, if the last line has a value, then
Jupyter helpfully prints out that value for you. However, it won't print out prior lines automatically. If
you want to print out a prior line, you need to add the
statement. Run the cell below to check.
Above, you should see that 4 is the value of the last expression, 2 is printed, but 3 is lost forever
because it was neither printed nor last.
You don't want to print everything all the time anyway. But if you feel sorry for 3, change the cell above
to print it.
The line in the next cell subtracts. Its value is what you'd expect. Run it.
3.25 - 1.5