Versions Compared

Key

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

...

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


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

...

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 Modified

(add floats next)

...


We can treat decimal numbers in a very similar way, and combine them with integers. 

Image Added

Booleans

Before we start looking at our next data type (Booleans), we can start a new cell to separate our previous code with our new code. To do this, press the "+" button in the Notebook menu. 

Image Added

Boolean variables are the simplest type of variables- any Boolean is either True or False. We can code them as such here:

Image Added


We can combine them using keywords "and" and "or". If two Boolean variables i and j are both True, then "i and j" results in True. In any other case, "i and j" results in False. 

Image Added

If either of the two Boolean variables i and are True, then "i or j" results in True. If both i and j are False, then "i or j" results in False. 

Image Added

Strings

Lists

Dictionaries

Functions

...