Booleans
Create a True/False value.
1is_sunny = True
2print(is_sunny)
$ python3 main.py
True
Every line, explained
is_sunny = True- A boolean is a value that can only be True or False, and in Python both words must start with a CAPITAL letter. Writing true or false is an error. Python names are written in snake_case: lowercase words joined with underscores. A name like is_sunny reads almost like a question: is sunny? True!
print(is_sunny)- print(...) shows whatever is inside its round brackets in the terminal, then moves to a new line. It is written all in lowercase, and it needs both brackets. Printing a boolean shows the word True or False.