
Predict
Comprehension Riddle
An if can appear in two places in a comprehension, and they do
different jobs. At the end, it filters. At the front, as
a if condition else b, it chooses a value.
words = ["ash", "moss", "", "fern", "ivy"]
result = [w[0] if len(w) > 3 else "-" for w in words if w]
print(result)