# [Python](https://www.python.org), 44 bytes <pre><code class="lang-python">def f(a,x): while[print(a.index(x))]:_,*a=a</code></pre> [Attempt This Online!](https://ato.pxeger.com/run?1=dY0xDsIgFIZ3TsEGNGAcDYlDW2_RNIbYhyUhlBCq9CwuLHqn3sbWunb43vLl-9_r46fYDy7n9xi1OM28A401VTwxifCzNxYaH4yLVB2M6yDRxFgrr7xQZ_VvpB4Cttg4PHhw9LiWMUyyKTQt4KEstUuDMKQb-Ci3OSKEIGxbyPO9ISXhpFqoF8of7XrQjql2Tb1rLmT79wU) Finishes with an exception. If not allowed: ## [Python](https://www.python.org), 49 bytes <pre><code class="lang-python">def f(a,x): while x in a:yield a.index(x);_,*a=a</code></pre> [Attempt This Online!](https://ato.pxeger.com/run?1=m72soLIkIz9vwYKlpSVpuhY3DVNS0xTSNBJ1KjStuBTKMzJzUhUqFDLzFBKtKjNTc1IUEvUy81JSKzQqNK3jdbQSbROhGtXS8osUckAq8wtS8zQMNK0KijLzSjSitdI0tFLLEnM0cjQ1YzUhqhfcTI9Wd1TXUXcCYmcgdgTjWBDBhUPGCaeMM04ZF3WIfQA) ## [Whython](https://github.com/pxeger/whython), 46 bytes <pre><code class="lang-python">def f(a,x): while[print(a.index(x))]?0:_,*a=a</code></pre> [Attempt This Online!](https://ato.pxeger.com/run?1=m728PKOyJCM_b8GCpaUlaboWN_VSUtMU0jQSdSo0rbgUyjMyc1KjC4oy80o0EvUy81JSKzQqNDVj7Q2s4nW0Em0Tobo00_KLFHIUMvMU8gtS8zQMNK3SNLRSyxJzNHI0Na0h-tV1dXXVNSEaFtxMj1Z3VNdRdwJiZyB2BONYEMGFQ8YJp4wzThkXdYh9AA)