Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

(setup notebook)

Python Data Types

The building blocks of a program are variables, which store data in a variety of forms. This data can be made available to the programmer and used later in the program in multiple ways.

Numbers

First, let's work with numbers in Python. By typing the code shown below, we can store the number 3 in variable a, and the number 4 in variable b.

Image Added


We can check the values of these variables by using the print function as shown below. Image Added


Click the "Run" button to run the code in the current cell as indicated below.

Image Added


After running this cell, we can see the values 3 and 4 appear just below the cell that has been run. 

Image Added


Now, we can run some basic arithmetic operations with these numbers. The operations shown below correspond to addition, subtraction, multiplication, and division, respectively. After printing each of the corresponding variables, we can see the results. 

Image Added


(add floats next)

Booleans

Strings

Lists

Dictionaries

Functions

...