Introduction
Conditional statements
Summary

Instruction

Great. You already discovered three basic variable types: integers, floats, and strings. To better understand conditional statements, we should first introduce another variable type: boolean. Boolean variables store logical values. They are named "Boolean" after the famous English logician George Boole.

Boolean variables can only take one of two values: True or False. There are lots of built-in functions in Python that will return a boolean value. For instance:

greeting = 'hello'
print(greeting.islower())

In the code above, we added a dot (.) after the variable name and called a function named islower(). This syntax means that we invoke the islower() function on the greeting variable.

islower() checks whether the string contains lowercase characters only. If this is the case, it returns True, which is what happens with our code.

Exercise

Run the template code and see what happens.

As you can see, islower() returned False the first time because the variable contained uppercase letters. The second time, it returned True.

Stuck? Here's a hint!

Simply run the sample code.