Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте How to Define a Type | Знайомство з числами в Python
Типи даних у Python
course content

Зміст курсу

Типи даних у Python

Типи даних у Python

1. Знайомство з числами в Python
2. Істина чи брехня?
3. Рядки
4. Поєднання всіх тем разом

book
How to Define a Type

We've previously come across float and integer types, so now we can tell whether a value is a float or an integer. Can you guess what the result of the math operation 6/1.5 might be? It's easy to calculate that it equals 4, but what type does 4 belong to? It might seem like an integer, but it's actually a float. To confirm its type, you can use the type() function.

123
variable = 6/1.5 print(variable) print(type(variable))
copy
Завдання

Swipe to start coding

An accountant received two reports: one contains the total revenue for the month, and the other records the number of successful transactions. Before calculating the average revenue per transaction, it's important to check if the data types are correct.

  1. Check the type of the number1 variable, which stores the total revenue.
  2. Check the type of the number2 variable, which stores the number of transactions.

Рішення

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

Як ми можемо покращити це?

Дякуємо за ваш відгук!

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

book
How to Define a Type

We've previously come across float and integer types, so now we can tell whether a value is a float or an integer. Can you guess what the result of the math operation 6/1.5 might be? It's easy to calculate that it equals 4, but what type does 4 belong to? It might seem like an integer, but it's actually a float. To confirm its type, you can use the type() function.

123
variable = 6/1.5 print(variable) print(type(variable))
copy
Завдання

Swipe to start coding

An accountant received two reports: one contains the total revenue for the month, and the other records the number of successful transactions. Before calculating the average revenue per transaction, it's important to check if the data types are correct.

  1. Check the type of the number1 variable, which stores the total revenue.
  2. Check the type of the number2 variable, which stores the number of transactions.

Рішення

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

Як ми можемо покращити це?

Дякуємо за ваш відгук!

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