[Solved] Creating a list that gives a specific value at even indexes and another value at odd indexes

[ad_1]

Literally write it as you would say it!

>>> ['a' if i % 2 else 'b' for i in range(10)]
['b', 'a', 'b', 'a', 'b', 'a', 'b', 'a', 'b', 'a']

2

[ad_2]

solved Creating a list that gives a specific value at even indexes and another value at odd indexes