28.1.2: Code and Output
selected template will load here
This action is not available.
Incredibly, that’s about it. Everything else in this book is going to concern what to type in those Code cells and how to interpret its output.
From now on, whenever I give example Python code in this book, I’ll write it like this
Code \(\PageIndex{1}\) (Python):
founding = 1776
usa_age = 2021 - founding
print("Our country is {} years old!".format(usa_age))
That means “this stuff goes in a Code cell of a Notebook.” When I write the corresponding output (i.e., what gets printed on the page immediately below the code cell when “Run All” is chosen from the “Cell” menu), I’ll write it like this:
| Our country is 245 years old!
That vertical bar means “this stuff is the printed result of executing the code cell.” Easy enough. Onward!