Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Python bool() Function | Boolean Type
Python Data Types

Deslize para mostrar o menu

book
Python bool() Function

In Python there is bool() function that converts variables of any type into a variable of boolean type (True or False). Let's look at an example for better understanding.

Input:
zero = 0
print(bool(zero))

Output:
False
Input:
one = 1
print(bool(one))

Output:
True
Input:
number = 10
print(bool(number))

Output:
True

Any digit other than zero is True.

Input:
x = None
print(bool(x))

Output:
False
Tarefa

Swipe to start coding

You have three numbers of different numeric types, you have to return a boolean object from each of one.

Solução

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 2
single

single

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

close

Awesome!

Completion rate improved to 3.85

book
Python bool() Function

In Python there is bool() function that converts variables of any type into a variable of boolean type (True or False). Let's look at an example for better understanding.

Input:
zero = 0
print(bool(zero))

Output:
False
Input:
one = 1
print(bool(one))

Output:
True
Input:
number = 10
print(bool(number))

Output:
True

Any digit other than zero is True.

Input:
x = None
print(bool(x))

Output:
False
Tarefa

Swipe to start coding

You have three numbers of different numeric types, you have to return a boolean object from each of one.

Solução

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

close

Awesome!

Completion rate improved to 3.85

Deslize para mostrar o menu

some-alt