Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Data types | Common data types
Learn Python from Scratch
course content

Зміст курсу

Learn Python from Scratch

Learn Python from Scratch

1. The basics
2. Arithmetic operations
3. Common data types
4. Conditional statements
5. Other data types
6. Loops
7. Functions

Data types

In Python, like in most programming languages, you can store objects of different types. But it's important to differentiate them in terms of computer memory. There are the following data types in Python:

  • Text Type: str
  • Numeric Types: int, float, complex
  • Sequence Types: list, tuple, range
  • Mapping Type: dict
  • Set Types: set, frozenset
  • Boolean Type: bool
  • Binary Types: bytes, bytearray, memoryview

Do not dig deep into all of those data types, as for now, we don't need that. We will consider every type in future chapters.

If you have a variable which you want to check its type, use the type() function. Do not forget to use the print function, so Python will print the result for us. For example,

1234
# create some variable var = (1,2) # check variable type print(type(var))
copy

Завдання

Check the types of variables days and sec_in_hour, defined in the code.

Завдання

Check the types of variables days and sec_in_hour, defined in the code.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 3. Розділ 1
toggle bottom row

Data types

In Python, like in most programming languages, you can store objects of different types. But it's important to differentiate them in terms of computer memory. There are the following data types in Python:

  • Text Type: str
  • Numeric Types: int, float, complex
  • Sequence Types: list, tuple, range
  • Mapping Type: dict
  • Set Types: set, frozenset
  • Boolean Type: bool
  • Binary Types: bytes, bytearray, memoryview

Do not dig deep into all of those data types, as for now, we don't need that. We will consider every type in future chapters.

If you have a variable which you want to check its type, use the type() function. Do not forget to use the print function, so Python will print the result for us. For example,

1234
# create some variable var = (1,2) # check variable type print(type(var))
copy

Завдання

Check the types of variables days and sec_in_hour, defined in the code.

Завдання

Check the types of variables days and sec_in_hour, defined in the code.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 3. Розділ 1
toggle bottom row

Data types

In Python, like in most programming languages, you can store objects of different types. But it's important to differentiate them in terms of computer memory. There are the following data types in Python:

  • Text Type: str
  • Numeric Types: int, float, complex
  • Sequence Types: list, tuple, range
  • Mapping Type: dict
  • Set Types: set, frozenset
  • Boolean Type: bool
  • Binary Types: bytes, bytearray, memoryview

Do not dig deep into all of those data types, as for now, we don't need that. We will consider every type in future chapters.

If you have a variable which you want to check its type, use the type() function. Do not forget to use the print function, so Python will print the result for us. For example,

1234
# create some variable var = (1,2) # check variable type print(type(var))
copy

Завдання

Check the types of variables days and sec_in_hour, defined in the code.

Завдання

Check the types of variables days and sec_in_hour, defined in the code.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

In Python, like in most programming languages, you can store objects of different types. But it's important to differentiate them in terms of computer memory. There are the following data types in Python:

  • Text Type: str
  • Numeric Types: int, float, complex
  • Sequence Types: list, tuple, range
  • Mapping Type: dict
  • Set Types: set, frozenset
  • Boolean Type: bool
  • Binary Types: bytes, bytearray, memoryview

Do not dig deep into all of those data types, as for now, we don't need that. We will consider every type in future chapters.

If you have a variable which you want to check its type, use the type() function. Do not forget to use the print function, so Python will print the result for us. For example,

1234
# create some variable var = (1,2) # check variable type print(type(var))
copy

Завдання

Check the types of variables days and sec_in_hour, defined in the code.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 3. Розділ 1
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt