What is Data Type?
A data type describes a set of data objects that all have the same structure and with which the same operations can be carried. It is the range of values of variables with which procedures work and which can be defined and manipulated.
Data types define which operations can be safely used for creating, transforming, and using variables in other arithmetic operations. Programming languages in which variables can only be used for certain data types are typed as sustainable and prevent errors. In comparison, programming languages are typed as chess if variables of one data type can be used like a variable of another data type.
The numeric data type only knows pure numerical values. If the variable only works with integer values, then it is an integer data type that is processed as a two- or four-byte long data type. If a data type uses numerical values with decimal places, then it is a numeric data type with a floating point number.
The Boolean data type is a special form of the integer data type. However, it only knows two values: “0” and “1”.
The alphanumeric data types are called characters, strings or character string variables.
Abstract data types are independent of the hardware and programming language of a computer system. Abstract data types are abstract because only the functionality is important and not the internal organization, which is masked.
A primitive data type is a basic data type for programming languages. It can no longer be dismantled and provides the basis for complex data types that are based on it. All operations can be traced back to the simple data type. The complex data type is made up of primitive data types and is based on the requirements of the corresponding programming language.
A user-defined data type is characterized by the fact that it contains data types of the respective programming languages. Variables with an elementary data type are characterized by the fact that elementary data types can accept exactly one value. out.
The data types integer and floating point number are often used in computer science to represent numbers. Texts are recorded using the string data type. The following table also shows the type identifier and the representation of the data objects in Python.
|Data type||Type identifier||Data|
|integer||int||Data of the type integer are all numbers …, -2, -1, 0, 1, 2, … up to a lower or upper limit defined in the programming language.|
|Floating point number||float||Floating-point number data are decimal numbers such as B. 4.2 or 0.03. There are a number of notations for such floating-point numbers, which must be looked up in the manual. Note that there are limits to the precision of floating-point numbers.|
|Truth value||bool||Truth value data are the truth values true and false.|
|String||str||Character string data are sequences of characters such as B. ‘Hello!’ or “I’m fine. You too?” Such strings are represented in Python with single or double quotes. You can find more about strings in the following sections.|
|Tuple||tuple||Data of the type tuple are combinations of several data into one unit. Examples of tuples are pairs like (12, 44) or triples like (21, ‘January’, 2012) or quadruples like (‘Saturday’, 21, 1, 2012) etc.|
|list||list||Data of the type list are also summaries of several data for one unit such as e.g. B. a list of numbers [1, 2, 3, 4, 5]. In a list, for example – in contrast to a tuple – further data can be inserted. You can find more about lists in the Lists section.|