More than just true and false
Python has two boolean values available for you to use: True and False. Most commonly these boolean values are used to indicate that something is on or off, yes or no, or similar states. Additionally, many python types return "truthy" or "falsey" values depending on their condition when evaluated using the bool() function.
Questo esercizio fa parte del corso
Data Types in Python
Istruzioni dell'esercizio
- Create an empty list called
my_list - Print the truthiness of
my_list. - Append the string
'cookies'to my_list - Print the truthiness of
my_list.
Esercizio pratico interattivo
Prova a risolvere questo esercizio completando il codice di esempio.
# Create an empty list
my_list = ____
# Check the truthiness of my_list
____(____(____))
# Append the string 'cookies' to my_list
____.____('cookies')
# Check the truthiness of my_list
print(____(____))