diff --git a/snippets/every_nth.md b/snippets/every_nth.md index 9223e0fae..a97a6ab46 100644 --- a/snippets/every_nth.md +++ b/snippets/every_nth.md @@ -5,11 +5,11 @@ tags: list,beginner Returns every nth element in a list. -Use `[1::nth]` to create a new list that contains every nth element of the given list. +Use `[nth-1::nth]` to create a new list that contains every nth element of the given list. ```py def every_nth(lst, nth): - return lst[1::nth] + return lst[nth-1::nth] ``` ```py