top of page

Data Types: Numbers

Data Types: Strings

Concatenation

Conversion

Data Types: Booleans

Checkpoint

Summary

Data Types: Numbers

In algebra, most variables store numbers. However, computers can store other types of data as variables, in addition to numbers.

 

Specifically, we will be storing four types of data in variables: floats, integers (ints), strings, and Booleans. We can use the command type() to assess the data type of the input.

We will start by taking a look at the two numerical types: floats and integers (ints). Floats contain decimal points whereas ints are whole numbers, positive or negative.

While we don't normally make the distinction between floats and ints typically, understanding how our computer interprets each of these data types is important for writing good code! Let's test the type of a couple of numbers:

1 print(type(10))

2 print(type(10.0))

3 print(type(-10))

bottom of page