Jul-22-2019, 05:37 AM
For completeness, the set comprehension is
text = ... {i for (i, c) in enumerate(text) if c.isupper()}Remember that sets are O(1) lookup and don't store their elements in a particular order.