Junior — Middle
What do you mean by 'data type' in programming?
sobes.tech AI
Answer from AI
A data type in programming is a characteristic that defines the set of values a variable can take, as well as the operations that can be performed on these values.
For example, in Python, there are data types:
- Numbers (int, float)
- Strings (str)
- Boolean values (bool)
- Lists (list)
- Dictionaries (dict)
The data type helps the compiler or interpreter understand how to process the data and how much memory to allocate.
Example:
x = 10 # x is an integer (int)
name = "Ivan" # name is a string (str)
flag = True # flag is a boolean value (bool)