Data Type

noun

say it: “DAY-tuh TYP” /ˈdeɪtə taɪp/

What kind of value something is, such as a whole number (int), a decimal (float), text (str) or True or False (bool); it decides what you can do with the value.

What is a data type?

A data type says what kind of value something is: a whole number, a decimal, text or True/False. The type decides what you can do with it.

age = 30          # int: whole number
price = 4.99      # float: decimal
name = "Lee"      # str: text
is_member = True  # bool: True or False

In a sentence

  • “type(4.99) shows the data type float.”
  • “"5" + 5 fails because the two values have different data types.”

Level: Novice · More Python terms at this level

Updated

In other subjects