pyassistant

Remove Every k-th Element from a List

Given a list of integers and a positive integer k, return a new list with every k-th element (1-indexed) removed. If k is less than or equal to 0, return a shallow copy of the original list. Maintain the original order of the remaining elements.

Example:

Input:
([1, 2, 3, 4, 5, 6, 7, 8], 3)
Output:
[1, 2, 4, 5, 7, 8]

Make sure you return your solution, don't print!

AI

Bot

Trying to solve my challenge? Ask if you must, or press the purple button so I can analyze your code.