diff --git a/snippet_data/snippetList.json b/snippet_data/snippetList.json index 5e25c85aa..d72f659bc 100644 --- a/snippet_data/snippetList.json +++ b/snippet_data/snippetList.json @@ -513,14 +513,14 @@ "type": "snippetListing", "title": "initialize_list_with_range", "attributes": { - "text": "Initializes a list containing the numbers in the specified range where `start` and `end` are inclusive with their common difference `step`.\n\nUse list comprehension and `range()` to generate a list of the appropriate length, filled with the desired values in the given range.\nOmit `start` to use the default value of `0`.\nOmit `step` to use the default value of `1`.\n\n", + "text": "Initializes a list containing the numbers in the specified range where `start` and `end` are inclusive with their common difference `step`.\n\nUse `list` and `range()` to generate a list of the appropriate length, filled with the desired values in the given range.\nOmit `start` to use the default value of `0`.\nOmit `step` to use the default value of `1`.\n\n", "tags": [ "list", "beginner" ] }, "meta": { - "hash": "b68fef168bb92503e54278a95753fd48b3cb9f5151e17d36ce69c7eae298683c" + "hash": "75ce66f70653b918d86f8bb7c2743bced720389c9f8f97072b4ff90b377255e1" } }, { diff --git a/snippet_data/snippets.json b/snippet_data/snippets.json index 17998f812..40b3ee143 100644 --- a/snippet_data/snippets.json +++ b/snippet_data/snippets.json @@ -679,9 +679,9 @@ "type": "snippet", "attributes": { "fileName": "initialize_list_with_range.md", - "text": "Initializes a list containing the numbers in the specified range where `start` and `end` are inclusive with their common difference `step`.\n\nUse list comprehension and `range()` to generate a list of the appropriate length, filled with the desired values in the given range.\nOmit `start` to use the default value of `0`.\nOmit `step` to use the default value of `1`.\n\n", + "text": "Initializes a list containing the numbers in the specified range where `start` and `end` are inclusive with their common difference `step`.\n\nUse `list` and `range()` to generate a list of the appropriate length, filled with the desired values in the given range.\nOmit `start` to use the default value of `0`.\nOmit `step` to use the default value of `1`.\n\n", "codeBlocks": { - "code": "def initialize_list_with_range(end, start = 0, step = 1):\n return [x for x in range(start, end + 1, step)]", + "code": "def initialize_list_with_range(end, start = 0, step = 1):\n return list(range(start, end + 1, step))", "example": "initialize_list_with_range(5) # [0, 1, 2, 3, 4, 5]\ninitialize_list_with_range(7,3) # [3, 4, 5, 6, 7]\ninitialize_list_with_range(9,0,2) # [0, 2, 4, 6, 8]" }, "tags": [ @@ -690,7 +690,7 @@ ] }, "meta": { - "hash": "b68fef168bb92503e54278a95753fd48b3cb9f5151e17d36ce69c7eae298683c" + "hash": "75ce66f70653b918d86f8bb7c2743bced720389c9f8f97072b4ff90b377255e1" } }, {