You can use the if else
condition to create a True or False row in Python. Here's an example:
main.py490 chars19 lines
This will output:
main.py33 chars2 lines
In this example, we create a list of numbers [4, 9, 16, 25, 36]
and an empty list tf_row
. We then loop through the list of numbers and check if each number is greater than 15. If it is, we append True
to tf_row
, otherwise we append False
. Finally, we print the true or false row [False, False, True, True, True]
.
gistlibby LogSnag