Data Types

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!)

<aside> 🚨 Case matters in Python! True and False are syntactically correct, while true and false are syntactically incorrect.

</aside>

Example code:

# *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.

Previous Chapter

Ch. 1 Intro to Python

Next Section

2.2 Variables

<aside> ⚖️ Copyright © 2021 Code 4 Tomorrow. All rights reserved. The code in this course is licensed under the MIT License.

If you would like to use content from any of our courses, you must obtain our explicit written permission and provide credit. Please contact [email protected] for inquiries.

</aside>