Data is information stored by the computer. In Python, we have many different types of data: strings, integers, floating numbers, boolean, and some others (that we won’t cover in this course). You can check the type of data of an object by using
type( ). ( Make sure to put the object between the parentheses!)
- Strings are a series of characters. Examples:
"I went to the store",
- Integers are normal numbers, like
100. They can’t have any decimals.
- Floating numbers are decimal numbers:
5.0might look like an integer, but since there’s a decimal point, it’s a float, even if there’s nothing after the decimal point
False(We’ll go deeper into booleans later in the course, for now just know that they exist)
Case matters in Python!
Falseare syntactically correct, while
falseare syntactically incorrect.
# strings are a series of characters # they are in single or double quotes print("Jane") print('Doe') # integers are whole numbers (positive, negative, and 0) print(25) # floating point numbers (floats) are numbers with decimals) print(16.54) # booleans are either true or false print(True) print(False)
View code on GitHub.