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

Kurssisisältö

Python Data Types

Python Data Types

1. Numeric Types
2. Boolean Type
3. Strings

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.

python
python
python

Any digit other than zero is True.

python
Tehtävä

Swipe to start coding

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

Ratkaisu

Switch to desktopVaihda työpöytään todellista harjoitusta vartenJatka siitä, missä olet käyttämällä jotakin alla olevista vaihtoehdoista
Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 2. Luku 2
toggle bottom row

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.

python
python
python

Any digit other than zero is True.

python
Tehtävä

Swipe to start coding

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

Ratkaisu

Switch to desktopVaihda työpöytään todellista harjoitusta vartenJatka siitä, missä olet käyttämällä jotakin alla olevista vaihtoehdoista
Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 2. Luku 2
Switch to desktopVaihda työpöytään todellista harjoitusta vartenJatka siitä, missä olet käyttämällä jotakin alla olevista vaihtoehdoista
Pahoittelemme, että jotain meni pieleen. Mitä tapahtui?
some-alt