⊗pyPmBsBV 28 of 208 menu

Boolean Values ​​in Python

In addition to numbers and strings, there is another data type - logical (boolean). It consists of only two possible values: True or False. These values ​​denote truth and falsehood, respectively.

The Boolean data type is used for things that require two possible answers - yes or no. For example, to the question "Are you already 18 years old?" you can answer yes, that is True, or no, that is False.

Let's look at an example:

isAdult = True # already an adult

Let's change the value to another:

isAdult = False # not an adult yet

Now let's display the value of our variable on the screen:

isAdult = False print(isAdult) # False

Set the variable to true. Print this variable to the screen.

Set the variable to false. Print this variable to the screen.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline