Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Converting: bool() | Поєднання всіх тем разом
Типи даних у Python
course content

Зміст курсу

Типи даних у Python

Типи даних у Python

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

book
Converting: bool()

This short practical chapter will get us acquainted with the bool() function. You may recall that numbers can be converted to the boolean data type too: 1 means True, and 0 means False.

Note

We can put whatever we want into the bool() function, and everything except 0 in different types (0, 0.0), and None will lead to True.

Завдання
test

Swipe to begin your solution

In this task, you'll practice using the bool() function to convert different values to boolean.

  1. Convert -90 to a boolean and store the result in statement1.
  2. Convert "La vie est belle" to a boolean and store the result in statement2.
  3. Convert None to a boolean and store the result in statement3.

Рішення

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

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

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

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

book
Converting: bool()

This short practical chapter will get us acquainted with the bool() function. You may recall that numbers can be converted to the boolean data type too: 1 means True, and 0 means False.

Note

We can put whatever we want into the bool() function, and everything except 0 in different types (0, 0.0), and None will lead to True.

Завдання
test

Swipe to begin your solution

In this task, you'll practice using the bool() function to convert different values to boolean.

  1. Convert -90 to a boolean and store the result in statement1.
  2. Convert "La vie est belle" to a boolean and store the result in statement2.
  3. Convert None to a boolean and store the result in statement3.

Рішення

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

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

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

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