Flag Every Third Row

Medium ⏱ 12 min 53% acceptance ★★★★★ 4.6
A report striper marks every third row (0-based indices 0, 3, 6, …) as highlighted. Write stripe(rows) returning a list of (row, is_highlighted) tuples using enumerate inside a comprehension.

Examples

Example 1
Input
stripe(['a', 'b', 'c', 'd'])
Output
[('a', True), ('b', False), ('c', False), ('d', True)]
Explanation

Indices 0 and 3 are multiples of three.

Constraints

  • Use enumerate inside the comprehension.
  • Highlight rule: index % 3 == 0.

Topics

List Comprehensionsenumerate

Companies

AtlassianServiceNow

Hints

Hint 1

for i, row in enumerate(rows) works inside a comprehension.

Hint 2

The boolean expression itself can sit in the tuple.

Loading the Python runtime… Run executes your code and shows printed output; Submit checks your function against this problem's examples.