Читать книгу Introduction to Python Programming for Business and Social Science Applications - Frederick Kaefer - Страница 41
Data Types
ОглавлениеA data type determines what kind of values a piece of data can have and what kind of operations you can perform on the data. Table 2.3 presents the commonly used data types in Python.
Table 2.3
Boolean data-type variables can store either True or False logical values. We will use variables of this data type in Chapter 4 when evaluating conditions that involve comparisons. Programmers use Integer data-type variables to store whole numbers. Variables of this data type are very useful for counting. Float data-type variables are also known as floating-point variables and can store decimal values. This type of variable is useful for situations where there can be fractional values, which often result when dividing numbers. Programmers use string data-type variables to store text that consists of letters, special symbols, and numbers. You enclose strings in quotes to reference them in code. Strings are very useful for composing messages to communicate to users and for creating labels used when formatting output results.