diff --git a/snippet-template.md b/snippet-template.md index 458ad256e..61f9161a4 100644 --- a/snippet-template.md +++ b/snippet-template.md @@ -1,5 +1,5 @@ --- -title: function_name +title: Function name tags: utility,intermediate firstSeen: 2021-06-13T05:00:00-04:00 --- diff --git a/snippets/add_days.md b/snippets/add_days.md index 954e1d72f..425e6ce94 100644 --- a/snippets/add_days.md +++ b/snippets/add_days.md @@ -1,5 +1,5 @@ --- -title: add_days +title: Add days to date tags: date,intermediate firstSeen: 2020-10-28T16:19:04+02:00 lastUpdated: 2020-10-28T16:19:04+02:00 diff --git a/snippets/all_equal.md b/snippets/all_equal.md index 79f6d063b..b3a0d1e6b 100644 --- a/snippets/all_equal.md +++ b/snippets/all_equal.md @@ -1,5 +1,5 @@ --- -title: all_equal +title: Check if list elements are identical tags: list,beginner firstSeen: 2019-08-20T11:39:18+03:00 lastUpdated: 2020-10-11T13:40:42+03:00 diff --git a/snippets/all_unique.md b/snippets/all_unique.md index ce7d5c178..532c520dd 100644 --- a/snippets/all_unique.md +++ b/snippets/all_unique.md @@ -1,5 +1,5 @@ --- -title: all_unique +title: Check if list has no duplicates tags: list,beginner firstSeen: 2018-04-01T11:03:09+03:00 lastUpdated: 2021-01-07T23:30:28+02:00 diff --git a/snippets/arithmetic_progression.md b/snippets/arithmetic_progression.md index 2fb19fa30..74cdcda0b 100644 --- a/snippets/arithmetic_progression.md +++ b/snippets/arithmetic_progression.md @@ -1,5 +1,5 @@ --- -title: arithmetic_progression +title: Arithmetic progression tags: math,beginner firstSeen: 2020-07-28T13:57:33+03:00 lastUpdated: 2020-11-02T19:27:07+02:00 @@ -15,5 +15,5 @@ def arithmetic_progression(n, lim): ``` ```py -arithmetic_progression(5, 25) # [5, 10, 15, 20, 25] +arithmetic_progression(5, 25) # [5, 10, 15, 20, 25] ``` diff --git a/snippets/average.md b/snippets/average.md index 9d6267dfc..d0d223e81 100644 --- a/snippets/average.md +++ b/snippets/average.md @@ -1,5 +1,5 @@ --- -title: average +title: Average tags: math,list,beginner firstSeen: 2018-01-27T07:16:41+02:00 lastUpdated: 2020-11-02T19:27:07+02:00 diff --git a/snippets/average_by.md b/snippets/average_by.md index 6c4e464ba..bab64e73e 100644 --- a/snippets/average_by.md +++ b/snippets/average_by.md @@ -1,5 +1,5 @@ --- -title: average_by +title: Mapped list average tags: math,list,intermediate firstSeen: 2019-08-20T11:55:10+03:00 lastUpdated: 2020-11-02T19:27:07+02:00 diff --git a/snippets/bifurcate.md b/snippets/bifurcate.md index 0092af1e6..db5e58806 100644 --- a/snippets/bifurcate.md +++ b/snippets/bifurcate.md @@ -1,11 +1,11 @@ --- -title: bifurcate +title: Bifurcate list based on values tags: list,intermediate firstSeen: 2019-08-20T12:37:06+03:00 lastUpdated: 2020-11-02T19:27:07+02:00 --- -Splits values into two groups, based on the result of the given `filter` list. +Splits values into two groups, based on the result of the given `filter` list. - Use a list comprehension and `zip()` to add elements to groups, based on `filter`. - If `filter` has a truthy value for any element, add it to the first group, otherwise add it to the second group. diff --git a/snippets/bifurcate_by.md b/snippets/bifurcate_by.md index 6d6fefcd9..10a6ff40b 100644 --- a/snippets/bifurcate_by.md +++ b/snippets/bifurcate_by.md @@ -1,5 +1,5 @@ --- -title: bifurcate_by +title: Bifurcate list based on function tags: list,intermediate firstSeen: 2019-08-20T12:41:21+03:00 lastUpdated: 2020-11-02T19:27:07+02:00 diff --git a/snippets/binomial_coefficient.md b/snippets/binomial_coefficient.md index e33f64c0c..efa08a3dd 100644 --- a/snippets/binomial_coefficient.md +++ b/snippets/binomial_coefficient.md @@ -1,5 +1,5 @@ --- -title: binomial_coefficient +title: Binomial coefficient tags: math,beginner firstSeen: 2020-10-04T11:56:31+03:00 lastUpdated: 2020-11-02T19:27:07+02:00 diff --git a/snippets/byte_size.md b/snippets/byte_size.md index d3f955048..b56db38e3 100644 --- a/snippets/byte_size.md +++ b/snippets/byte_size.md @@ -1,5 +1,5 @@ --- -title: byte_size +title: Byte size of string tags: string,beginner firstSeen: 2018-02-01T10:19:59+02:00 lastUpdated: 2020-11-02T19:27:07+02:00 diff --git a/snippets/camel.md b/snippets/camel.md index b79248151..68274d68a 100644 --- a/snippets/camel.md +++ b/snippets/camel.md @@ -1,5 +1,5 @@ --- -title: camel +title: Camelcase string tags: string,regexp,intermediate firstSeen: 2019-08-21T08:59:54+03:00 lastUpdated: 2020-11-02T19:27:07+02:00 diff --git a/snippets/capitalize.md b/snippets/capitalize.md index 0e38e70d8..f3a6d5cf9 100644 --- a/snippets/capitalize.md +++ b/snippets/capitalize.md @@ -1,5 +1,5 @@ --- -title: capitalize +title: Capitalize string tags: string,intermediate firstSeen: 2018-02-01T10:19:59+02:00 lastUpdated: 2020-11-02T19:27:07+02:00 diff --git a/snippets/capitalize_every_word.md b/snippets/capitalize_every_word.md index 784d4b6ca..669e015b7 100644 --- a/snippets/capitalize_every_word.md +++ b/snippets/capitalize_every_word.md @@ -1,5 +1,5 @@ --- -title: capitalize_every_word +title: Capitalize every word tags: string,beginner firstSeen: 2018-02-01T10:19:59+02:00 lastUpdated: 2020-11-02T19:27:07+02:00 diff --git a/snippets/cast_list.md b/snippets/cast_list.md index d077c0ef8..f7b12984a 100644 --- a/snippets/cast_list.md +++ b/snippets/cast_list.md @@ -1,5 +1,5 @@ --- -title: cast_list +title: Cast to list tags: list,intermediate firstSeen: 2019-08-20T12:47:43+03:00 lastUpdated: 2020-11-02T19:27:07+02:00 diff --git a/snippets/celsius_to_fahrenheit.md b/snippets/celsius_to_fahrenheit.md index 39aac29b4..152415a9c 100644 --- a/snippets/celsius_to_fahrenheit.md +++ b/snippets/celsius_to_fahrenheit.md @@ -1,5 +1,5 @@ --- -title: celsius_to_fahrenheit +title: Celsius to Fahrenheit tags: math,beginner unlisted: true firstSeen: 2020-04-05T12:29:03+03:00 diff --git a/snippets/check_prop.md b/snippets/check_prop.md index dff5991f8..f192388d0 100644 --- a/snippets/check_prop.md +++ b/snippets/check_prop.md @@ -1,13 +1,13 @@ --- -title: check_prop +title: Check property tags: function,intermediate firstSeen: 2020-01-02T16:49:25+02:00 lastUpdated: 2020-11-02T19:27:07+02:00 --- -Creates a function that will invoke a predicate function for the specified property on a given object. +Creates a function that will invoke a predicate function for the specified property on a given dictionary. -- Return a `lambda` function that takes an object and applies the predicate function, `fn` to the specified property. +- Return a `lambda` function that takes a dictionary and applies the predicate function, `fn` to the specified property. ```py def check_prop(fn, prop): diff --git a/snippets/chunk.md b/snippets/chunk.md index b6c584289..3f17053cf 100644 --- a/snippets/chunk.md +++ b/snippets/chunk.md @@ -1,5 +1,5 @@ --- -title: chunk +title: Split list into chunks tags: list,intermediate firstSeen: 2018-01-09T06:39:42+02:00 lastUpdated: 2020-11-02T19:27:07+02:00 diff --git a/snippets/chunk_into_n.md b/snippets/chunk_into_n.md index 211c53f72..c8165b8dd 100644 --- a/snippets/chunk_into_n.md +++ b/snippets/chunk_into_n.md @@ -1,5 +1,5 @@ --- -title: chunk_into_n +title: Split list into n chunks tags: list,intermediate firstSeen: 2020-10-12T22:11:30+03:00 lastUpdated: 2020-10-23T05:35:06+03:00 diff --git a/snippets/clamp_number.md b/snippets/clamp_number.md index ba17926fe..39d5117c3 100644 --- a/snippets/clamp_number.md +++ b/snippets/clamp_number.md @@ -1,5 +1,5 @@ --- -title: clamp_number +title: Clamp number tags: math,beginner firstSeen: 2019-08-20T12:50:38+03:00 lastUpdated: 2020-11-02T19:27:07+02:00 diff --git a/snippets/collect_dictionary.md b/snippets/collect_dictionary.md index d380b6d73..8e09635e5 100644 --- a/snippets/collect_dictionary.md +++ b/snippets/collect_dictionary.md @@ -1,5 +1,5 @@ --- -title: collect_dictionary +title: Invert dictionary tags: dictionary,intermediate firstSeen: 2020-04-07T21:15:06+03:00 lastUpdated: 2020-11-02T19:27:07+02:00 @@ -7,7 +7,7 @@ lastUpdated: 2020-11-02T19:27:07+02:00 Inverts a dictionary with non-unique hashable values. -- Create a `collections.defaultdict` with `list` as the default value for each key. +- Create a `collections.defaultdict` with `list` as the default value for each key. - Use `dictionary.items()` in combination with a loop to map the values of the dictionary to keys using `dict.append()`. - Use `dict()` to convert the `collections.defaultdict` to a regular dictionary. diff --git a/snippets/combine_values.md b/snippets/combine_values.md index 4164e6cfb..2a72ea82a 100644 --- a/snippets/combine_values.md +++ b/snippets/combine_values.md @@ -1,5 +1,5 @@ --- -title: combine_values +title: Combine dictionary values tags: dictionary,intermediate firstSeen: 2021-03-07T12:30:47+02:00 lastUpdated: 2021-04-04T14:32:35+03:00 diff --git a/snippets/compact.md b/snippets/compact.md index ad3d06673..defe3cfd6 100644 --- a/snippets/compact.md +++ b/snippets/compact.md @@ -1,5 +1,5 @@ --- -title: compact +title: Compact list tags: list,beginner firstSeen: 2018-01-19T12:17:06+02:00 lastUpdated: 2020-11-02T19:27:07+02:00 diff --git a/snippets/compose.md b/snippets/compose.md index d4401050d..dfb34db72 100644 --- a/snippets/compose.md +++ b/snippets/compose.md @@ -1,5 +1,5 @@ --- -title: compose +title: Compose functions tags: function,advanced firstSeen: 2020-01-02T15:51:20+02:00 lastUpdated: 2020-11-02T19:27:07+02:00 diff --git a/snippets/compose_right.md b/snippets/compose_right.md index 73a2ee1a9..fd9fe8e01 100644 --- a/snippets/compose_right.md +++ b/snippets/compose_right.md @@ -1,5 +1,5 @@ --- -title: compose_right +title: Reverse compose functions tags: function,advanced firstSeen: 2020-01-02T15:51:26+02:00 lastUpdated: 2020-11-02T19:27:07+02:00 diff --git a/snippets/count_by.md b/snippets/count_by.md index 6c0ffdf02..cb5f95710 100644 --- a/snippets/count_by.md +++ b/snippets/count_by.md @@ -1,5 +1,5 @@ --- -title: count_by +title: Count grouped elements tags: list,intermediate firstSeen: 2018-02-07T10:33:47+02:00 lastUpdated: 2020-11-02T19:27:07+02:00 diff --git a/snippets/count_occurrences.md b/snippets/count_occurrences.md index 2dc413583..0260d1070 100644 --- a/snippets/count_occurrences.md +++ b/snippets/count_occurrences.md @@ -1,5 +1,5 @@ --- -title: count_occurrences +title: Count occurrences tags: list,beginner firstSeen: 2021-01-10T00:00:36+02:00 lastUpdated: 2021-01-10T00:00:36+02:00 diff --git a/snippets/cumsum.md b/snippets/cumsum.md index 3c8fa7794..d551d5bcd 100644 --- a/snippets/cumsum.md +++ b/snippets/cumsum.md @@ -1,5 +1,5 @@ --- -title: cumsum +title: Partial sum list tags: list,intermediate firstSeen: 2021-01-13T23:30:41+02:00 lastUpdated: 2021-01-13T23:30:41+02:00 diff --git a/snippets/curry.md b/snippets/curry.md index 1e232a70b..2c141fb54 100644 --- a/snippets/curry.md +++ b/snippets/curry.md @@ -1,5 +1,5 @@ --- -title: curry +title: Curry function tags: function,intermediate firstSeen: 2020-01-02T16:14:50+02:00 lastUpdated: 2020-11-02T19:27:07+02:00 diff --git a/snippets/daterange.md b/snippets/daterange.md index ac411397e..5c393687c 100644 --- a/snippets/daterange.md +++ b/snippets/daterange.md @@ -1,5 +1,5 @@ --- -title: daterange +title: Date range tags: date,intermediate firstSeen: 2020-10-28T16:19:14+02:00 lastUpdated: 2021-01-07T23:30:28+02:00 diff --git a/snippets/days_ago.md b/snippets/days_ago.md index 1cbb0ac9a..780846b90 100644 --- a/snippets/days_ago.md +++ b/snippets/days_ago.md @@ -1,5 +1,5 @@ --- -title: days_ago +title: Days ago tags: date,intermediate firstSeen: 2020-10-28T16:19:30+02:00 lastUpdated: 2020-10-28T16:19:30+02:00 diff --git a/snippets/days_diff.md b/snippets/days_diff.md index 2374169fc..960c65965 100644 --- a/snippets/days_diff.md +++ b/snippets/days_diff.md @@ -1,5 +1,5 @@ --- -title: days_diff +title: Date difference in days tags: date,beginner firstSeen: 2020-10-28T16:19:39+02:00 lastUpdated: 2020-10-28T16:19:39+02:00 diff --git a/snippets/days_from_now.md b/snippets/days_from_now.md index 35a4c801d..b92cf839c 100644 --- a/snippets/days_from_now.md +++ b/snippets/days_from_now.md @@ -1,5 +1,5 @@ --- -title: days_from_now +title: Days from now tags: date,intermediate firstSeen: 2020-10-28T16:19:51+02:00 lastUpdated: 2020-10-28T16:19:51+02:00 diff --git a/snippets/decapitalize.md b/snippets/decapitalize.md index dd43c2a5c..9102a73c3 100644 --- a/snippets/decapitalize.md +++ b/snippets/decapitalize.md @@ -1,5 +1,5 @@ --- -title: decapitalize +title: Decapitalize string tags: string,intermediate firstSeen: 2018-02-01T10:19:59+02:00 lastUpdated: 2020-11-02T19:27:53+02:00 diff --git a/snippets/deep_flatten.md b/snippets/deep_flatten.md index 0b35872be..7a92ae06d 100644 --- a/snippets/deep_flatten.md +++ b/snippets/deep_flatten.md @@ -1,5 +1,5 @@ --- -title: deep_flatten +title: Deep flatten list tags: list,recursion,intermediate firstSeen: 2018-01-16T16:54:14+02:00 lastUpdated: 2020-12-29T19:53:45+02:00 diff --git a/snippets/degrees_to_rads.md b/snippets/degrees_to_rads.md index 3bb652523..aca903cfb 100644 --- a/snippets/degrees_to_rads.md +++ b/snippets/degrees_to_rads.md @@ -1,5 +1,5 @@ --- -title: degrees_to_rads +title: Degrees to radians tags: math,beginner firstSeen: 2019-10-15T14:31:11+03:00 lastUpdated: 2020-11-02T19:27:53+02:00 diff --git a/snippets/delay.md b/snippets/delay.md index 722a4f3f6..68d89605c 100644 --- a/snippets/delay.md +++ b/snippets/delay.md @@ -1,5 +1,5 @@ --- -title: delay +title: Delayed function execution tags: function,intermediate firstSeen: 2020-01-02T16:24:51+02:00 lastUpdated: 2020-11-02T19:27:53+02:00 diff --git a/snippets/dict_to_list.md b/snippets/dict_to_list.md index 1ea0a2d48..940aba4e9 100644 --- a/snippets/dict_to_list.md +++ b/snippets/dict_to_list.md @@ -1,5 +1,5 @@ --- -title: dict_to_list +title: Dictionary to list tags: dictionary,list,intermediate firstSeen: 2020-10-16T21:24:14+03:00 lastUpdated: 2020-11-02T19:27:53+02:00 diff --git a/snippets/difference.md b/snippets/difference.md index aece687fa..9b480638f 100644 --- a/snippets/difference.md +++ b/snippets/difference.md @@ -1,5 +1,5 @@ --- -title: difference +title: List difference tags: list,beginner firstSeen: 2018-01-20T16:16:44+02:00 lastUpdated: 2020-11-02T19:27:53+02:00 diff --git a/snippets/difference_by.md b/snippets/difference_by.md index f28234eda..1180ffc3b 100644 --- a/snippets/difference_by.md +++ b/snippets/difference_by.md @@ -1,5 +1,5 @@ --- -title: difference_by +title: List difference based on function tags: list,function,intermediate firstSeen: 2018-02-08T15:59:27+02:00 lastUpdated: 2020-11-02T19:27:53+02:00 diff --git a/snippets/digitize.md b/snippets/digitize.md index 2e22c5f8c..83f840b93 100644 --- a/snippets/digitize.md +++ b/snippets/digitize.md @@ -1,5 +1,5 @@ --- -title: digitize +title: Digitize number tags: math,list,beginner firstSeen: 2019-08-20T13:00:27+03:00 lastUpdated: 2020-09-15T16:13:06+03:00 diff --git a/snippets/drop.md b/snippets/drop.md index 14a6ab8aa..6a00ebb16 100644 --- a/snippets/drop.md +++ b/snippets/drop.md @@ -1,5 +1,5 @@ --- -title: drop +title: Drop list elements from the left tags: list,beginner firstSeen: 2020-03-10T21:59:41+02:00 lastUpdated: 2020-11-02T19:27:53+02:00 diff --git a/snippets/drop_right.md b/snippets/drop_right.md index 465e47a46..e60103b17 100644 --- a/snippets/drop_right.md +++ b/snippets/drop_right.md @@ -1,5 +1,5 @@ --- -title: drop_right +title: Drop list elements from the right tags: list,beginner firstSeen: 2020-03-10T21:59:41+02:00 lastUpdated: 2020-11-02T19:27:53+02:00 diff --git a/snippets/every.md b/snippets/every.md index 1d667267f..069f120fb 100644 --- a/snippets/every.md +++ b/snippets/every.md @@ -1,5 +1,5 @@ --- -title: every +title: Test if every list element is truthy tags: list,intermediate firstSeen: 2019-08-20T11:34:24+03:00 lastUpdated: 2020-11-02T19:27:53+02:00 diff --git a/snippets/every_nth.md b/snippets/every_nth.md index 74840ef89..db55eceb4 100644 --- a/snippets/every_nth.md +++ b/snippets/every_nth.md @@ -1,5 +1,5 @@ --- -title: every_nth +title: Every nth element in list tags: list,beginner firstSeen: 2019-08-20T13:10:12+03:00 lastUpdated: 2020-11-02T19:27:53+02:00 diff --git a/snippets/factorial.md b/snippets/factorial.md index d0cd8c9cc..a78257fb0 100644 --- a/snippets/factorial.md +++ b/snippets/factorial.md @@ -1,5 +1,5 @@ --- -title: factorial +title: Factorial tags: math,recursion,beginner firstSeen: 2018-01-27T07:29:56+02:00 lastUpdated: 2020-09-15T16:13:06+03:00 diff --git a/snippets/fahrenheit_to_celsius.md b/snippets/fahrenheit_to_celsius.md index 75dde9323..c3e8bf2b2 100644 --- a/snippets/fahrenheit_to_celsius.md +++ b/snippets/fahrenheit_to_celsius.md @@ -1,5 +1,5 @@ --- -title: fahrenheit_to_celsius +title: Fahrenheit to Celsius tags: math,beginner unlisted: true firstSeen: 2020-04-05T12:29:03+03:00 diff --git a/snippets/fibonacci.md b/snippets/fibonacci.md index c57356a5d..600d77b41 100644 --- a/snippets/fibonacci.md +++ b/snippets/fibonacci.md @@ -1,5 +1,5 @@ --- -title: fibonacci +title: Fibonacci tags: math,list,intermediate firstSeen: 2018-10-06T06:06:33+03:00 lastUpdated: 2020-11-02T19:27:53+02:00 diff --git a/snippets/filter_non_unique.md b/snippets/filter_non_unique.md index 9c9f5d634..258eca21e 100644 --- a/snippets/filter_non_unique.md +++ b/snippets/filter_non_unique.md @@ -1,5 +1,5 @@ --- -title: filter_non_unique +title: Filter non-unique list values tags: list,beginner firstSeen: 2019-08-20T13:13:51+03:00 lastUpdated: 2020-11-02T19:27:53+02:00 diff --git a/snippets/filter_unique.md b/snippets/filter_unique.md index f5d8c3fe7..293aeaa14 100644 --- a/snippets/filter_unique.md +++ b/snippets/filter_unique.md @@ -1,5 +1,5 @@ --- -title: filter_unique +title: Filter unique list values tags: list,beginner firstSeen: 2019-10-02T20:06:24+03:00 lastUpdated: 2020-11-02T19:27:53+02:00 diff --git a/snippets/find.md b/snippets/find.md index 89b05bf1e..c56ab68f0 100644 --- a/snippets/find.md +++ b/snippets/find.md @@ -1,5 +1,5 @@ --- -title: find +title: Find matching value tags: list,beginner firstSeen: 2020-03-10T22:38:48+02:00 lastUpdated: 2020-11-02T19:27:53+02:00 diff --git a/snippets/find_index.md b/snippets/find_index.md index 2bf44ac4a..ac7b5ae07 100644 --- a/snippets/find_index.md +++ b/snippets/find_index.md @@ -1,5 +1,5 @@ --- -title: find_index +title: Find matching index tags: list,intermediate firstSeen: 2020-03-10T22:38:48+02:00 lastUpdated: 2020-11-02T19:27:53+02:00 diff --git a/snippets/find_index_of_all.md b/snippets/find_index_of_all.md index 5701135de..dcc2c5c7a 100644 --- a/snippets/find_index_of_all.md +++ b/snippets/find_index_of_all.md @@ -1,5 +1,5 @@ --- -title: find_index_of_all +title: Find all matching indexes tags: list,intermediate firstSeen: 2020-10-11T13:45:19+03:00 lastUpdated: 2020-11-02T19:27:53+02:00 diff --git a/snippets/find_key.md b/snippets/find_key.md index b95fbb0bf..5978d1110 100644 --- a/snippets/find_key.md +++ b/snippets/find_key.md @@ -1,5 +1,5 @@ --- -title: find_key +title: Find key of value tags: dictionary,intermediate firstSeen: 2020-04-16T19:13:20+03:00 lastUpdated: 2020-11-02T19:27:53+02:00 diff --git a/snippets/find_keys.md b/snippets/find_keys.md index 63256dd1d..5163b270d 100644 --- a/snippets/find_keys.md +++ b/snippets/find_keys.md @@ -1,5 +1,5 @@ --- -title: find_keys +title: Find keys with value tags: dictionary,intermediate firstSeen: 2020-04-16T19:17:13+03:00 lastUpdated: 2020-11-02T19:27:53+02:00 diff --git a/snippets/find_last.md b/snippets/find_last.md index bbab175b2..ad83890d7 100644 --- a/snippets/find_last.md +++ b/snippets/find_last.md @@ -1,5 +1,5 @@ --- -title: find_last +title: Find last matching value tags: list,beginner firstSeen: 2020-03-10T22:38:48+02:00 lastUpdated: 2020-11-02T19:27:53+02:00 diff --git a/snippets/find_last_index.md b/snippets/find_last_index.md index 9e87007e5..3231c93de 100644 --- a/snippets/find_last_index.md +++ b/snippets/find_last_index.md @@ -1,5 +1,5 @@ --- -title: find_last_index +title: Find last matching index tags: list,beginner firstSeen: 2020-03-10T22:38:48+02:00 lastUpdated: 2020-11-02T19:27:53+02:00 diff --git a/snippets/find_parity_outliers.md b/snippets/find_parity_outliers.md index f53d44a0f..656f21d4e 100644 --- a/snippets/find_parity_outliers.md +++ b/snippets/find_parity_outliers.md @@ -1,5 +1,5 @@ --- -title: find_parity_outliers +title: Find parity outliers tags: list,math,intermediate firstSeen: 2020-01-08T18:54:35+02:00 lastUpdated: 2020-11-02T19:27:53+02:00 diff --git a/snippets/flatten.md b/snippets/flatten.md index b220c86c3..d25dc1910 100644 --- a/snippets/flatten.md +++ b/snippets/flatten.md @@ -1,5 +1,5 @@ --- -title: flatten +title: Flatten list tags: list,intermediate firstSeen: 2019-09-19T15:46:10+03:00 lastUpdated: 2020-11-02T19:27:53+02:00 diff --git a/snippets/for_each.md b/snippets/for_each.md index 5a95e9e31..d05df47b3 100644 --- a/snippets/for_each.md +++ b/snippets/for_each.md @@ -1,5 +1,5 @@ --- -title: for_each +title: Execute function for each list element tags: list,beginner firstSeen: 2020-03-15T12:54:08+02:00 lastUpdated: 2020-09-15T16:13:06+03:00 diff --git a/snippets/for_each_right.md b/snippets/for_each_right.md index be899ad37..4fb15e170 100644 --- a/snippets/for_each_right.md +++ b/snippets/for_each_right.md @@ -1,5 +1,5 @@ --- -title: for_each_right +title: Execute function for each list element in reverse tags: list,beginner firstSeen: 2020-03-15T12:54:08+02:00 lastUpdated: 2020-09-15T16:13:06+03:00 diff --git a/snippets/frequencies.md b/snippets/frequencies.md index 6e7ba3497..b25e09a6a 100644 --- a/snippets/frequencies.md +++ b/snippets/frequencies.md @@ -1,5 +1,5 @@ --- -title: frequencies +title: Value frequencies tags: list,intermediate firstSeen: 2020-03-15T12:54:08+02:00 lastUpdated: 2020-11-02T19:27:53+02:00 diff --git a/snippets/from_iso_date.md b/snippets/from_iso_date.md index ca22ecf75..3a143aeaf 100644 --- a/snippets/from_iso_date.md +++ b/snippets/from_iso_date.md @@ -1,5 +1,5 @@ --- -title: from_iso_date +title: Date from ISO format tags: date,intermediate firstSeen: 2020-10-28T16:20:04+02:00 lastUpdated: 2021-01-07T23:30:28+02:00 diff --git a/snippets/gcd.md b/snippets/gcd.md index f0f36a7f8..c882a196f 100644 --- a/snippets/gcd.md +++ b/snippets/gcd.md @@ -1,5 +1,5 @@ --- -title: gcd +title: Greatest common divisor tags: math,beginner firstSeen: 2018-01-08T16:26:35+02:00 lastUpdated: 2020-09-15T16:13:06+03:00 diff --git a/snippets/geometric_progression.md b/snippets/geometric_progression.md index e426ecd7c..eaf1d1254 100644 --- a/snippets/geometric_progression.md +++ b/snippets/geometric_progression.md @@ -1,14 +1,14 @@ --- -title: geometric_progression +title: Geometric progression tags: math,list,intermediate firstSeen: 2020-10-04T12:19:28+03:00 lastUpdated: 2020-11-02T19:28:05+02:00 --- Initializes a list containing the numbers in the specified range where `start` and `end` are inclusive and the ratio between two terms is `step`. -Returns an error if `step` equals `1`. - Use `range()`, `math.log()` and `math.floor()` and a list comprehension to create a list of the appropriate length, applying the step for each element. +- Returns an error if `step` equals `1`. - Omit the second argument, `start`, to use a default value of `1`. - Omit the third argument, `step`, to use a default value of `2`. diff --git a/snippets/get.md b/snippets/get.md index 3c0080c46..5fafc892d 100644 --- a/snippets/get.md +++ b/snippets/get.md @@ -1,5 +1,5 @@ --- -title: get +title: Get nested value tags: dictionary,list,intermediate firstSeen: 2020-10-28T12:21:39+02:00 lastUpdated: 2020-10-28T12:21:39+02:00 @@ -11,7 +11,7 @@ Retrieves the value of the nested key indicated by the given selector list from - Apply `operator.getitem()` for each key in `selectors`, retrieving the value to be used as the iteratee for the next iteration. ```py -from functools import reduce +from functools import reduce from operator import getitem def get(d, selectors): @@ -23,7 +23,7 @@ users = { 'freddy': { 'name': { 'first': 'fred', - 'last': 'smith' + 'last': 'smith' }, 'postIds': [1, 2, 3] } diff --git a/snippets/group_by.md b/snippets/group_by.md index ca9ee3c19..fb8fd09b8 100644 --- a/snippets/group_by.md +++ b/snippets/group_by.md @@ -1,5 +1,5 @@ --- -title: group_by +title: Group list elements tags: list,dictionary,intermediate firstSeen: 2019-08-20T13:29:00+03:00 lastUpdated: 2020-11-02T19:28:05+02:00 diff --git a/snippets/hamming_distance.md b/snippets/hamming_distance.md index a78c83d70..9040f67fc 100644 --- a/snippets/hamming_distance.md +++ b/snippets/hamming_distance.md @@ -1,5 +1,5 @@ --- -title: hamming_distance +title: Hamming distance tags: math,intermediate firstSeen: 2021-01-17T13:04:06+02:00 lastUpdated: 2021-02-18T14:22:25+02:00 diff --git a/snippets/has_duplicates.md b/snippets/has_duplicates.md index c8ee94f12..61588f5b2 100644 --- a/snippets/has_duplicates.md +++ b/snippets/has_duplicates.md @@ -1,5 +1,5 @@ --- -title: has_duplicates +title: Check for duplicates in list tags: list,beginner firstSeen: 2018-04-01T11:03:09+03:00 lastUpdated: 2020-11-02T19:28:05+02:00 diff --git a/snippets/have_same_contents.md b/snippets/have_same_contents.md index 7da8726f4..0608a4795 100644 --- a/snippets/have_same_contents.md +++ b/snippets/have_same_contents.md @@ -1,5 +1,5 @@ --- -title: have_same_contents +title: Check lists have same contents tags: list,intermediate firstSeen: 2020-03-15T12:54:08+02:00 lastUpdated: 2020-11-02T19:28:05+02:00 diff --git a/snippets/head.md b/snippets/head.md index 4e8d17bcc..9c31b00df 100644 --- a/snippets/head.md +++ b/snippets/head.md @@ -1,5 +1,5 @@ --- -title: head +title: List head tags: list,beginner firstSeen: 2019-08-20T14:08:52+03:00 lastUpdated: 2020-09-15T16:13:06+03:00 diff --git a/snippets/hex_to_rgb.md b/snippets/hex_to_rgb.md index d13af2c24..b84a8301b 100644 --- a/snippets/hex_to_rgb.md +++ b/snippets/hex_to_rgb.md @@ -1,5 +1,5 @@ --- -title: hex_to_rgb +title: Hex to RGB tags: string,math,intermediate firstSeen: 2020-09-13T01:08:21+03:00 lastUpdated: 2020-09-15T16:13:06+03:00 diff --git a/snippets/in_range.md b/snippets/in_range.md index 2b30bffae..4b7ae2f8f 100644 --- a/snippets/in_range.md +++ b/snippets/in_range.md @@ -1,5 +1,5 @@ --- -title: in_range +title: Number in range tags: math,beginner firstSeen: 2019-08-20T13:41:40+03:00 lastUpdated: 2020-09-15T16:13:06+03:00 diff --git a/snippets/includes_all.md b/snippets/includes_all.md index fdb5b8fbc..1470e5e09 100644 --- a/snippets/includes_all.md +++ b/snippets/includes_all.md @@ -1,5 +1,5 @@ --- -title: includes_all +title: List includes all values tags: list,intermediate firstSeen: 2020-03-15T12:54:08+02:00 lastUpdated: 2020-11-02T19:28:05+02:00 diff --git a/snippets/includes_any.md b/snippets/includes_any.md index e1310ab53..eee9f8393 100644 --- a/snippets/includes_any.md +++ b/snippets/includes_any.md @@ -1,5 +1,5 @@ --- -title: includes_any +title: List includes any values tags: list,intermediate firstSeen: 2020-03-15T12:54:08+02:00 lastUpdated: 2020-11-02T19:28:05+02:00 diff --git a/snippets/index_of_all.md b/snippets/index_of_all.md index 0460427b3..83d115d98 100644 --- a/snippets/index_of_all.md +++ b/snippets/index_of_all.md @@ -1,5 +1,5 @@ --- -title: index_of_all +title: All indexes of value tags: list,intermediate firstSeen: 2020-10-11T13:40:42+03:00 lastUpdated: 2020-10-11T13:45:19+03:00 @@ -16,5 +16,5 @@ def index_of_all(lst, value): ```py index_of_all([1, 2, 1, 4, 5, 1], 1) # [0, 2, 5] -index_of_all([1, 2, 3, 4], 6) # [] +index_of_all([1, 2, 3, 4], 6) # [] ``` diff --git a/snippets/initial.md b/snippets/initial.md index a11f27c00..9b1f72282 100644 --- a/snippets/initial.md +++ b/snippets/initial.md @@ -1,5 +1,5 @@ --- -title: initial +title: List without last element tags: list,beginner firstSeen: 2019-08-20T14:08:52+03:00 lastUpdated: 2020-11-02T19:28:05+02:00 diff --git a/snippets/initialize_2d_list.md b/snippets/initialize_2d_list.md index df9514269..97aacffc1 100644 --- a/snippets/initialize_2d_list.md +++ b/snippets/initialize_2d_list.md @@ -1,5 +1,5 @@ --- -title: initialize_2d_list +title: Initialize 2D list tags: list,intermediate firstSeen: 2019-10-25T10:11:51+03:00 lastUpdated: 2020-11-02T19:28:05+02:00 diff --git a/snippets/initialize_list_with_range.md b/snippets/initialize_list_with_range.md index bc4501916..49eb7ca82 100644 --- a/snippets/initialize_list_with_range.md +++ b/snippets/initialize_list_with_range.md @@ -1,5 +1,5 @@ --- -title: initialize_list_with_range +title: Initialize list with range tags: list,beginner firstSeen: 2019-08-20T15:21:41+03:00 lastUpdated: 2020-11-02T19:28:05+02:00 diff --git a/snippets/initialize_list_with_values.md b/snippets/initialize_list_with_values.md index 9d8715fed..4d2789858 100644 --- a/snippets/initialize_list_with_values.md +++ b/snippets/initialize_list_with_values.md @@ -1,5 +1,5 @@ --- -title: initialize_list_with_values +title: Initialize list with values tags: list,beginner firstSeen: 2019-08-20T14:12:06+03:00 lastUpdated: 2020-11-02T19:28:05+02:00 diff --git a/snippets/intersection.md b/snippets/intersection.md index 6d1a18996..2541c88bd 100644 --- a/snippets/intersection.md +++ b/snippets/intersection.md @@ -1,5 +1,5 @@ --- -title: intersection +title: List intersection tags: list,beginner firstSeen: 2019-08-20T15:14:26+03:00 lastUpdated: 2020-11-02T19:28:05+02:00 diff --git a/snippets/intersection_by.md b/snippets/intersection_by.md index 5ad79f54c..fe9dde706 100644 --- a/snippets/intersection_by.md +++ b/snippets/intersection_by.md @@ -1,5 +1,5 @@ --- -title: intersection_by +title: List intersection based on function tags: list,function,intermediate firstSeen: 2019-08-20T15:16:27+03:00 lastUpdated: 2020-11-02T19:28:05+02:00 diff --git a/snippets/invert_dictionary.md b/snippets/invert_dictionary.md index 0f0b9e23f..847b1e5ab 100644 --- a/snippets/invert_dictionary.md +++ b/snippets/invert_dictionary.md @@ -1,5 +1,5 @@ --- -title: invert_dictionary +title: Invert dictionary tags: dictionary,intermediate firstSeen: 2020-04-07T21:13:32+03:00 lastUpdated: 2020-11-02T19:28:05+02:00 diff --git a/snippets/is_anagram.md b/snippets/is_anagram.md index 733e022c8..a8cc8c76d 100644 --- a/snippets/is_anagram.md +++ b/snippets/is_anagram.md @@ -1,5 +1,5 @@ --- -title: is_anagram +title: String is anagram tags: string,intermediate firstSeen: 2018-10-01T13:17:29+03:00 lastUpdated: 2020-11-02T19:28:05+02:00 diff --git a/snippets/is_contained_in.md b/snippets/is_contained_in.md index 76d1a3718..46ce3ea62 100644 --- a/snippets/is_contained_in.md +++ b/snippets/is_contained_in.md @@ -1,5 +1,5 @@ --- -title: is_contained_in +title: List is contained in other list tags: list,intermediate firstSeen: 2020-03-16T19:48:15+02:00 lastUpdated: 2021-01-07T23:30:28+02:00 diff --git a/snippets/is_divisible.md b/snippets/is_divisible.md index 36ea7d4cd..f516c4a8c 100644 --- a/snippets/is_divisible.md +++ b/snippets/is_divisible.md @@ -1,5 +1,5 @@ --- -title: is_divisible +title: Number is divisible tags: math,beginner unlisted: true firstSeen: 2019-08-20T14:19:55+03:00 diff --git a/snippets/is_even.md b/snippets/is_even.md index f8997c655..e75ac0942 100644 --- a/snippets/is_even.md +++ b/snippets/is_even.md @@ -1,5 +1,5 @@ --- -title: is_even +title: Number is even tags: math,beginner unlisted: true firstSeen: 2019-08-20T14:21:44+03:00 diff --git a/snippets/is_odd.md b/snippets/is_odd.md index cc4559b48..c19e3c730 100644 --- a/snippets/is_odd.md +++ b/snippets/is_odd.md @@ -1,5 +1,5 @@ --- -title: is_odd +title: Number is odd tags: math,beginner unlisted: true firstSeen: 2019-08-20T14:21:44+03:00 diff --git a/snippets/is_prime.md b/snippets/is_prime.md index 9eac36c2e..2feb5bb58 100644 --- a/snippets/is_prime.md +++ b/snippets/is_prime.md @@ -1,5 +1,5 @@ --- -title: is_prime +title: Number is prime tags: math,intermediate firstSeen: 2020-10-03T18:03:32+03:00 lastUpdated: 2020-11-02T19:28:05+02:00 @@ -15,7 +15,7 @@ Checks if the provided integer is a prime number. from math import sqrt def is_prime(n): - if n <= 1 or (n % 2 == 0 and n > 2): + if n <= 1 or (n % 2 == 0 and n > 2): return False return all(n % i for i in range(3, int(sqrt(n)) + 1, 2)) ``` diff --git a/snippets/is_weekday.md b/snippets/is_weekday.md index 68c77c725..1b8de107c 100644 --- a/snippets/is_weekday.md +++ b/snippets/is_weekday.md @@ -1,5 +1,5 @@ --- -title: is_weekday +title: Date is weekday tags: date,beginner firstSeen: 2020-10-28T16:20:18+02:00 lastUpdated: 2020-11-02T19:28:05+02:00 @@ -15,7 +15,7 @@ Checks if the given date is a weekday. from datetime import datetime def is_weekday(d = datetime.today()): - return d.weekday() <= 4 + return d.weekday() <= 4 ``` ```py diff --git a/snippets/is_weekend.md b/snippets/is_weekend.md index ab141c969..0273ef7e0 100644 --- a/snippets/is_weekend.md +++ b/snippets/is_weekend.md @@ -1,5 +1,5 @@ --- -title: is_weekend +title: Date is weekend tags: date,beginner firstSeen: 2020-10-28T16:20:27+02:00 lastUpdated: 2020-11-02T19:28:05+02:00 @@ -15,7 +15,7 @@ Checks if the given date is a weekend. from datetime import datetime def is_weekend(d = datetime.today()): - return d.weekday() > 4 + return d.weekday() > 4 ``` ```py diff --git a/snippets/kebab.md b/snippets/kebab.md index 50cf2602a..08f8f2594 100644 --- a/snippets/kebab.md +++ b/snippets/kebab.md @@ -1,5 +1,5 @@ --- -title: kebab +title: Kebabcase string tags: string,regexp,intermediate firstSeen: 2019-08-21T08:59:54+03:00 lastUpdated: 2020-11-02T19:28:05+02:00 diff --git a/snippets/key_in_dict.md b/snippets/key_in_dict.md index 81dd8093d..a0541f508 100644 --- a/snippets/key_in_dict.md +++ b/snippets/key_in_dict.md @@ -1,5 +1,5 @@ --- -title: key_in_dict +title: Key in dictionary tags: dictionary,beginner firstSeen: 2020-10-16T21:30:49+03:00 lastUpdated: 2020-10-16T21:30:49+03:00 diff --git a/snippets/key_of_max.md b/snippets/key_of_max.md index dd760cb41..898217f90 100644 --- a/snippets/key_of_max.md +++ b/snippets/key_of_max.md @@ -1,5 +1,5 @@ --- -title: key_of_max +title: Key of max value tags: dictionary,beginner firstSeen: 2021-01-07T23:15:48+02:00 lastUpdated: 2021-01-07T23:15:48+02:00 diff --git a/snippets/key_of_min.md b/snippets/key_of_min.md index 402e5c519..fab00ea44 100644 --- a/snippets/key_of_min.md +++ b/snippets/key_of_min.md @@ -1,5 +1,5 @@ --- -title: key_of_min +title: Key of min value tags: dictionary,beginner firstSeen: 2021-01-07T23:15:48+02:00 lastUpdated: 2021-01-07T23:15:48+02:00 diff --git a/snippets/keys_only.md b/snippets/keys_only.md index 138f67837..bfec66c4f 100644 --- a/snippets/keys_only.md +++ b/snippets/keys_only.md @@ -1,5 +1,5 @@ --- -title: keys_only +title: Dictionary keys tags: dictionary,list,beginner firstSeen: 2018-04-01T23:56:31+03:00 lastUpdated: 2020-11-02T19:28:05+02:00 diff --git a/snippets/km_to_miles.md b/snippets/km_to_miles.md index c371fa544..40cb9c55d 100644 --- a/snippets/km_to_miles.md +++ b/snippets/km_to_miles.md @@ -1,5 +1,5 @@ --- -title: km_to_miles +title: Km to miles tags: math,beginner unlisted: true firstSeen: 2020-10-04T00:23:49+03:00 diff --git a/snippets/last.md b/snippets/last.md index 4baebaa01..d4f692024 100644 --- a/snippets/last.md +++ b/snippets/last.md @@ -1,5 +1,5 @@ --- -title: last +title: Last list element tags: list,beginner firstSeen: 2019-08-20T15:11:47+03:00 lastUpdated: 2020-11-02T19:28:05+02:00 diff --git a/snippets/lcm.md b/snippets/lcm.md index 7dce5229b..b60284059 100644 --- a/snippets/lcm.md +++ b/snippets/lcm.md @@ -1,5 +1,5 @@ --- -title: lcm +title: Least common multiple tags: math,list,intermediate firstSeen: 2018-01-08T22:30:17+02:00 lastUpdated: 2020-11-02T19:31:15+02:00 diff --git a/snippets/longest_item.md b/snippets/longest_item.md index 755cac0d0..71ad5fb91 100644 --- a/snippets/longest_item.md +++ b/snippets/longest_item.md @@ -1,11 +1,11 @@ --- -title: longest_item +title: Longest item tags: list,string,intermediate firstSeen: 2019-08-20T15:27:49+03:00 lastUpdated: 2021-10-17T18:24:43+02:00 --- -Takes any number of iterable objects or objects with a length property and returns the longest one. +Takes any number of iterable objects or objects with a length property and returns the longest one. - Use `max()` with `len()` as the `key` to return the item with the greatest length. - If multiple items have the same length, the first one will be returned. diff --git a/snippets/map_dictionary.md b/snippets/map_dictionary.md index b1a69a361..186e10cc2 100644 --- a/snippets/map_dictionary.md +++ b/snippets/map_dictionary.md @@ -1,5 +1,5 @@ --- -title: map_dictionary +title: Map list to dictionary tags: list,dictionary,intermediate firstSeen: 2020-04-07T19:53:48+03:00 lastUpdated: 2020-11-02T19:28:27+02:00 diff --git a/snippets/map_values.md b/snippets/map_values.md index 92be4ce49..5f566a930 100644 --- a/snippets/map_values.md +++ b/snippets/map_values.md @@ -1,5 +1,5 @@ --- -title: map_values +title: Map dictionary values tags: dictionary,intermediate firstSeen: 2019-08-20T15:34:30+03:00 lastUpdated: 2020-11-02T19:28:27+02:00 diff --git a/snippets/max_by.md b/snippets/max_by.md index f49f5d20b..48e6a8f94 100644 --- a/snippets/max_by.md +++ b/snippets/max_by.md @@ -1,5 +1,5 @@ --- -title: max_by +title: Max list value based on function tags: math,list,beginner firstSeen: 2019-08-20T15:42:41+03:00 lastUpdated: 2020-11-02T19:28:27+02:00 diff --git a/snippets/max_element_index.md b/snippets/max_element_index.md index 13acfb3d2..ca37fed0c 100644 --- a/snippets/max_element_index.md +++ b/snippets/max_element_index.md @@ -1,5 +1,5 @@ --- -title: max_element_index +title: Index of max element tags: math,list,beginner firstSeen: 2019-10-31T09:42:21+02:00 lastUpdated: 2020-11-02T19:28:27+02:00 diff --git a/snippets/max_n.md b/snippets/max_n.md index 1958b1cc0..148a1c477 100644 --- a/snippets/max_n.md +++ b/snippets/max_n.md @@ -1,11 +1,11 @@ --- -title: max_n +title: N max elements tags: list,math,beginner firstSeen: 2018-01-19T11:25:28+02:00 lastUpdated: 2020-11-02T19:28:27+02:00 --- -Returns the `n` maximum elements from the provided list. +Returns the `n` maximum elements from the provided list. - Use `sorted()` to sort the list. - Use slice notation to get the specified number of elements. diff --git a/snippets/median.md b/snippets/median.md index 428f0875d..36894caa9 100644 --- a/snippets/median.md +++ b/snippets/median.md @@ -1,5 +1,5 @@ --- -title: median +title: Median tags: math,beginner firstSeen: 2019-10-03T12:02:17+03:00 lastUpdated: 2020-11-02T19:28:27+02:00 diff --git a/snippets/merge.md b/snippets/merge.md index 3f2c08df7..ade9e3133 100644 --- a/snippets/merge.md +++ b/snippets/merge.md @@ -1,5 +1,5 @@ --- -title: merge +title: Merge lists tags: list,advanced firstSeen: 2020-04-13T19:09:12+03:00 lastUpdated: 2020-11-02T19:28:27+02:00 diff --git a/snippets/merge_dictionaries.md b/snippets/merge_dictionaries.md index d6f640de3..6adae78ba 100644 --- a/snippets/merge_dictionaries.md +++ b/snippets/merge_dictionaries.md @@ -1,5 +1,5 @@ --- -title: merge_dictionaries +title: Merge dictionaries tags: dictionary,intermediate firstSeen: 2020-04-16T19:28:35+03:00 lastUpdated: 2020-11-02T19:28:27+02:00 diff --git a/snippets/miles_to_km.md b/snippets/miles_to_km.md index f10fcd38c..95e440725 100644 --- a/snippets/miles_to_km.md +++ b/snippets/miles_to_km.md @@ -1,5 +1,5 @@ --- -title: miles_to_km +title: Miles to km tags: math,beginner unlisted: true firstSeen: 2020-10-04T00:24:01+03:00 diff --git a/snippets/min_by.md b/snippets/min_by.md index c6ae5ab9d..286222b4e 100644 --- a/snippets/min_by.md +++ b/snippets/min_by.md @@ -1,5 +1,5 @@ --- -title: min_by +title: Min list value based on function tags: math,list,beginner firstSeen: 2019-08-20T15:42:41+03:00 lastUpdated: 2020-11-02T19:28:27+02:00 diff --git a/snippets/min_element_index.md b/snippets/min_element_index.md index 41765a5ee..70a4e54be 100644 --- a/snippets/min_element_index.md +++ b/snippets/min_element_index.md @@ -1,5 +1,5 @@ --- -title: min_element_index +title: Index of min element tags: math,list,beginner firstSeen: 2020-10-05T22:32:00+03:00 lastUpdated: 2020-11-02T19:28:27+02:00 diff --git a/snippets/min_n.md b/snippets/min_n.md index d7ee9243f..86effaf3a 100644 --- a/snippets/min_n.md +++ b/snippets/min_n.md @@ -1,11 +1,11 @@ --- -title: min_n +title: N min elements tags: list,math,beginner firstSeen: 2018-01-19T11:25:28+02:00 lastUpdated: 2020-11-02T19:28:27+02:00 --- -Returns the `n` minimum elements from the provided list. +Returns the `n` minimum elements from the provided list. - Use `sorted()` to sort the list. - Use slice notation to get the specified number of elements. diff --git a/snippets/months_diff.md b/snippets/months_diff.md index 4506c4459..e63f316e7 100644 --- a/snippets/months_diff.md +++ b/snippets/months_diff.md @@ -1,5 +1,5 @@ --- -title: months_diff +title: Date difference in months tags: date,beginner firstSeen: 2020-10-28T16:20:39+02:00 lastUpdated: 2020-10-28T16:20:39+02:00 diff --git a/snippets/most_frequent.md b/snippets/most_frequent.md index 06c76c1dc..7be1de3ac 100644 --- a/snippets/most_frequent.md +++ b/snippets/most_frequent.md @@ -1,5 +1,5 @@ --- -title: most_frequent +title: Most frequent element tags: list,beginner firstSeen: 2019-10-12T00:40:49+03:00 lastUpdated: 2020-11-02T19:28:27+02:00 diff --git a/snippets/n_times_string.md b/snippets/n_times_string.md index ee75a0fc3..b81a048cf 100644 --- a/snippets/n_times_string.md +++ b/snippets/n_times_string.md @@ -1,5 +1,5 @@ --- -title: n_times_string +title: Repeat string tags: string,beginner firstSeen: 2019-09-27T10:07:25+03:00 lastUpdated: 2020-11-02T19:28:27+02:00 diff --git a/snippets/none.md b/snippets/none.md index 7b64d0272..86334cac8 100644 --- a/snippets/none.md +++ b/snippets/none.md @@ -1,5 +1,5 @@ --- -title: none +title: Test if every list element is falsy tags: list,intermediate firstSeen: 2019-08-20T15:54:50+03:00 lastUpdated: 2020-11-02T19:28:27+02:00 diff --git a/snippets/num_to_range.md b/snippets/num_to_range.md index b83dcc8c0..acb6f6529 100644 --- a/snippets/num_to_range.md +++ b/snippets/num_to_range.md @@ -1,5 +1,5 @@ --- -title: num_to_range +title: Map number to range tags: math,beginner firstSeen: 2020-10-04T12:43:57+03:00 lastUpdated: 2021-04-05T18:25:46+03:00 diff --git a/snippets/offset.md b/snippets/offset.md index 787bcc1e2..040fca2a3 100644 --- a/snippets/offset.md +++ b/snippets/offset.md @@ -1,5 +1,5 @@ --- -title: offset +title: Offset list elements tags: list,beginner firstSeen: 2019-08-20T15:53:15+03:00 lastUpdated: 2020-11-02T19:28:27+02:00 diff --git a/snippets/pad.md b/snippets/pad.md index 964c07391..a574b5b62 100644 --- a/snippets/pad.md +++ b/snippets/pad.md @@ -1,5 +1,5 @@ --- -title: pad +title: Pad string tags: string,beginner firstSeen: 2020-10-04T01:53:05+03:00 lastUpdated: 2020-10-04T01:53:05+03:00 diff --git a/snippets/pad_number.md b/snippets/pad_number.md index 767725662..706ba08ad 100644 --- a/snippets/pad_number.md +++ b/snippets/pad_number.md @@ -1,5 +1,5 @@ --- -title: pad_number +title: Pad number tags: string,math,beginner firstSeen: 2020-10-04T01:42:19+03:00 lastUpdated: 2020-11-02T19:28:27+02:00 diff --git a/snippets/palindrome.md b/snippets/palindrome.md index faf920b94..b4e423a2f 100644 --- a/snippets/palindrome.md +++ b/snippets/palindrome.md @@ -1,5 +1,5 @@ --- -title: palindrome +title: Palindrome tags: string,intermediate firstSeen: 2018-02-01T10:19:59+02:00 lastUpdated: 2020-11-02T19:28:27+02:00 diff --git a/snippets/pluck.md b/snippets/pluck.md index dd08a8714..a35db8f03 100644 --- a/snippets/pluck.md +++ b/snippets/pluck.md @@ -1,5 +1,5 @@ --- -title: pluck +title: Pluck values from list of dictionaries tags: list,dictionary,beginner firstSeen: 2020-10-22T03:49:25+03:00 lastUpdated: 2020-10-22T10:09:44+03:00 diff --git a/snippets/powerset.md b/snippets/powerset.md index c43241e06..3c7b23616 100644 --- a/snippets/powerset.md +++ b/snippets/powerset.md @@ -1,5 +1,5 @@ --- -title: powerset +title: Powerset tags: math,list,advanced firstSeen: 2020-10-04T13:14:01+03:00 lastUpdated: 2020-11-02T19:28:27+02:00 diff --git a/snippets/rads_to_degrees.md b/snippets/rads_to_degrees.md index 845382391..e9150540f 100644 --- a/snippets/rads_to_degrees.md +++ b/snippets/rads_to_degrees.md @@ -1,5 +1,5 @@ --- -title: rads_to_degrees +title: Radians to degrees tags: math,beginner firstSeen: 2019-08-20T15:58:57+03:00 lastUpdated: 2020-11-02T19:28:27+02:00 diff --git a/snippets/reverse.md b/snippets/reverse.md index 6586b1b70..bfa039497 100644 --- a/snippets/reverse.md +++ b/snippets/reverse.md @@ -1,5 +1,5 @@ --- -title: reverse +title: Reverse list tags: list,string,beginner firstSeen: 2020-10-06T19:02:30+03:00 lastUpdated: 2020-11-02T19:28:27+02:00 @@ -15,6 +15,6 @@ def reverse(itr): ``` ```py -reverse([1, 2, 3]) # [3, 2, 1] -reverse('snippet') # 'teppins' +reverse([1, 2, 3]) # [3, 2, 1] +reverse('snippet') # 'teppins' ``` diff --git a/snippets/reverse_number.md b/snippets/reverse_number.md index 63e693f90..19c6c42b6 100644 --- a/snippets/reverse_number.md +++ b/snippets/reverse_number.md @@ -1,5 +1,5 @@ --- -title: reverse_number +title: Reverse number tags: math,intermediate firstSeen: 2020-10-04T14:21:41+03:00 lastUpdated: 2020-11-02T19:28:27+02:00 diff --git a/snippets/rgb_to_hex.md b/snippets/rgb_to_hex.md index b007dc09d..1a416e61e 100644 --- a/snippets/rgb_to_hex.md +++ b/snippets/rgb_to_hex.md @@ -1,5 +1,5 @@ --- -title: rgb_to_hex +title: RGB to hex tags: string,math,intermediate firstSeen: 2020-09-13T01:08:00+03:00 lastUpdated: 2020-11-02T19:28:27+02:00 diff --git a/snippets/roll.md b/snippets/roll.md index 7def092c0..a7cca6648 100644 --- a/snippets/roll.md +++ b/snippets/roll.md @@ -1,5 +1,5 @@ --- -title: roll +title: Rotate list elements tags: list,beginner firstSeen: 2020-11-02T19:15:44+02:00 lastUpdated: 2020-11-02T19:15:44+02:00 diff --git a/snippets/sample.md b/snippets/sample.md index 05a6a2f18..014199ead 100644 --- a/snippets/sample.md +++ b/snippets/sample.md @@ -1,5 +1,5 @@ --- -title: sample +title: Random element in list tags: list,random,beginner firstSeen: 2019-08-20T16:02:37+03:00 lastUpdated: 2020-10-28T11:45:34+02:00 diff --git a/snippets/shuffle.md b/snippets/shuffle.md index 1a84c129b..3fc319cea 100644 --- a/snippets/shuffle.md +++ b/snippets/shuffle.md @@ -1,5 +1,5 @@ --- -title: shuffle +title: Shuffle list tags: list,random,advanced firstSeen: 2018-01-19T11:59:33+02:00 lastUpdated: 2020-11-02T19:28:35+02:00 diff --git a/snippets/similarity.md b/snippets/similarity.md index 3eb5706b3..3f8f56c2d 100644 --- a/snippets/similarity.md +++ b/snippets/similarity.md @@ -1,5 +1,5 @@ --- -title: similarity +title: List similarity tags: list,beginner firstSeen: 2019-08-20T16:12:11+03:00 lastUpdated: 2020-11-02T19:28:35+02:00 diff --git a/snippets/slugify.md b/snippets/slugify.md index 97de6c7db..5a88359a7 100644 --- a/snippets/slugify.md +++ b/snippets/slugify.md @@ -1,5 +1,5 @@ --- -title: slugify +title: String to slug tags: string,regexp,intermediate firstSeen: 2020-10-05T21:57:34+03:00 lastUpdated: 2020-10-25T12:43:20+02:00 diff --git a/snippets/snake.md b/snippets/snake.md index 56ac8e45f..510d43825 100644 --- a/snippets/snake.md +++ b/snippets/snake.md @@ -1,5 +1,5 @@ --- -title: snake +title: Snakecase string tags: string,regexp,intermediate firstSeen: 2019-08-21T08:59:54+03:00 lastUpdated: 2020-11-02T19:28:35+02:00 diff --git a/snippets/some.md b/snippets/some.md index cb06e3645..bdabe636c 100644 --- a/snippets/some.md +++ b/snippets/some.md @@ -1,5 +1,5 @@ --- -title: some +title: Test if some list elements are truthy tags: list,intermediate firstSeen: 2019-08-20T11:42:30+03:00 lastUpdated: 2020-11-02T19:28:35+02:00 diff --git a/snippets/sort_by_indexes.md b/snippets/sort_by_indexes.md index 5c34f9cd2..159f27fd9 100644 --- a/snippets/sort_by_indexes.md +++ b/snippets/sort_by_indexes.md @@ -1,5 +1,5 @@ --- -title: sort_by_indexes +title: Sort list by indexes tags: list,intermediate firstSeen: 2020-09-07T09:58:39+03:00 lastUpdated: 2020-11-02T19:28:35+02:00 diff --git a/snippets/sort_dict_by_key.md b/snippets/sort_dict_by_key.md index d3371f1c6..a40273a46 100644 --- a/snippets/sort_dict_by_key.md +++ b/snippets/sort_dict_by_key.md @@ -1,5 +1,5 @@ --- -title: sort_dict_by_key +title: Sort dictionary by key tags: dictionary,intermediate firstSeen: 2020-10-16T21:24:33+03:00 lastUpdated: 2020-11-02T19:28:35+02:00 diff --git a/snippets/sort_dict_by_value.md b/snippets/sort_dict_by_value.md index 1bc807b81..bbee3b141 100644 --- a/snippets/sort_dict_by_value.md +++ b/snippets/sort_dict_by_value.md @@ -1,5 +1,5 @@ --- -title: sort_dict_by_value +title: Sort dictionary by value tags: dictionary,intermediate firstSeen: 2020-10-16T21:25:19+03:00 lastUpdated: 2021-01-08T00:56:50+02:00 diff --git a/snippets/split_lines.md b/snippets/split_lines.md index e4e2adffc..37ab1491b 100644 --- a/snippets/split_lines.md +++ b/snippets/split_lines.md @@ -1,5 +1,5 @@ --- -title: split_lines +title: Split into lines tags: string,beginner firstSeen: 2019-08-20T16:15:15+03:00 lastUpdated: 2020-11-02T19:28:35+02:00 diff --git a/snippets/spread.md b/snippets/spread.md index 8a4ea0950..17aa48ae8 100644 --- a/snippets/spread.md +++ b/snippets/spread.md @@ -1,5 +1,5 @@ --- -title: spread +title: Spread list tags: list,intermediate firstSeen: 2018-01-08T22:38:05+02:00 lastUpdated: 2020-09-15T16:13:06+03:00 diff --git a/snippets/sum_by.md b/snippets/sum_by.md index 8de6aeeae..6bc68ce57 100644 --- a/snippets/sum_by.md +++ b/snippets/sum_by.md @@ -1,5 +1,5 @@ --- -title: sum_by +title: Sum list based on function tags: math,list,beginner firstSeen: 2019-08-21T08:30:04+03:00 lastUpdated: 2020-11-02T19:28:35+02:00 diff --git a/snippets/sum_of_powers.md b/snippets/sum_of_powers.md index a94efdcf9..b0e6abc62 100644 --- a/snippets/sum_of_powers.md +++ b/snippets/sum_of_powers.md @@ -1,5 +1,5 @@ --- -title: sum_of_powers +title: Sum of powers tags: math,intermediate firstSeen: 2020-10-04T14:21:41+03:00 lastUpdated: 2020-11-02T19:28:35+02:00 diff --git a/snippets/symmetric_difference.md b/snippets/symmetric_difference.md index 1c11740e8..ca46245b6 100644 --- a/snippets/symmetric_difference.md +++ b/snippets/symmetric_difference.md @@ -1,5 +1,5 @@ --- -title: symmetric_difference +title: List symmetric difference tags: list,intermediate firstSeen: 2019-08-21T08:37:04+03:00 lastUpdated: 2020-11-02T19:28:35+02:00 diff --git a/snippets/symmetric_difference_by.md b/snippets/symmetric_difference_by.md index 2d71672e5..14a29f171 100644 --- a/snippets/symmetric_difference_by.md +++ b/snippets/symmetric_difference_by.md @@ -1,5 +1,5 @@ --- -title: symmetric_difference_by +title: List symmetric difference based on function tags: list,intermediate firstSeen: 2019-08-21T08:37:04+03:00 lastUpdated: 2020-11-02T19:28:35+02:00 diff --git a/snippets/tail.md b/snippets/tail.md index f13622fef..e6f180667 100644 --- a/snippets/tail.md +++ b/snippets/tail.md @@ -1,5 +1,5 @@ --- -title: tail +title: List tail tags: list,beginner firstSeen: 2019-08-20T14:08:52+03:00 lastUpdated: 2020-11-02T19:28:35+02:00 diff --git a/snippets/take.md b/snippets/take.md index d3837140c..4609ea7b8 100644 --- a/snippets/take.md +++ b/snippets/take.md @@ -1,5 +1,5 @@ --- -title: take +title: Remove list elements tags: list,beginner firstSeen: 2020-03-16T19:52:44+02:00 lastUpdated: 2020-09-15T16:13:06+03:00 diff --git a/snippets/take_right.md b/snippets/take_right.md index 00798e30f..21444db2e 100644 --- a/snippets/take_right.md +++ b/snippets/take_right.md @@ -1,5 +1,5 @@ --- -title: take_right +title: Remove list elements from the end tags: list,beginner firstSeen: 2020-03-16T19:52:44+02:00 lastUpdated: 2020-09-15T16:13:06+03:00 diff --git a/snippets/to_binary.md b/snippets/to_binary.md index c9572d7f5..40ea29c05 100644 --- a/snippets/to_binary.md +++ b/snippets/to_binary.md @@ -1,5 +1,5 @@ --- -title: to_binary +title: Number to binary tags: math,beginner firstSeen: 2020-10-07T19:46:01+03:00 lastUpdated: 2020-10-07T19:46:01+03:00 diff --git a/snippets/to_dictionary.md b/snippets/to_dictionary.md index 7507f3bdb..136d27743 100644 --- a/snippets/to_dictionary.md +++ b/snippets/to_dictionary.md @@ -1,5 +1,5 @@ --- -title: to_dictionary +title: Lists to dictionary tags: list,dictionary,intermediate firstSeen: 2020-04-13T19:30:29+03:00 lastUpdated: 2020-11-02T19:28:35+02:00 diff --git a/snippets/to_hex.md b/snippets/to_hex.md index 1dfbe2124..de40c1668 100644 --- a/snippets/to_hex.md +++ b/snippets/to_hex.md @@ -1,5 +1,5 @@ --- -title: to_hex +title: Number to hex tags: math,beginner firstSeen: 2020-10-09T09:45:47+03:00 lastUpdated: 2020-10-09T09:45:47+03:00 diff --git a/snippets/to_iso_date.md b/snippets/to_iso_date.md index eeb83b3bd..2e49ea76a 100644 --- a/snippets/to_iso_date.md +++ b/snippets/to_iso_date.md @@ -1,5 +1,5 @@ --- -title: to_iso_date +title: Date to ISO format tags: date,intermediate firstSeen: 2020-10-28T16:20:50+02:00 lastUpdated: 2021-01-07T23:30:28+02:00 diff --git a/snippets/to_roman_numeral.md b/snippets/to_roman_numeral.md index 5791b89d2..215005cd5 100644 --- a/snippets/to_roman_numeral.md +++ b/snippets/to_roman_numeral.md @@ -1,11 +1,11 @@ --- -title: to_roman_numeral +title: Integer to roman numeral tags: math,string,intermediate firstSeen: 2020-10-07T00:04:09+03:00 lastUpdated: 2020-11-02T19:28:35+02:00 --- -Converts an integer to its roman numeral representation. +Converts an integer to its roman numeral representation. Accepts value between `1` and `3999` (both inclusive). - Create a lookup list containing tuples in the form of (roman value, integer). diff --git a/snippets/transpose.md b/snippets/transpose.md index e2cd0cabd..1051c1033 100644 --- a/snippets/transpose.md +++ b/snippets/transpose.md @@ -1,5 +1,5 @@ --- -title: transpose +title: Transpose matrix tags: list,intermediate firstSeen: 2019-10-02T07:03:20+03:00 lastUpdated: 2020-11-02T19:28:35+02:00 diff --git a/snippets/unfold.md b/snippets/unfold.md index d1dfc3c6e..f2d8d2a69 100644 --- a/snippets/unfold.md +++ b/snippets/unfold.md @@ -1,5 +1,5 @@ --- -title: unfold +title: Unfold list tags: function,list,advanced firstSeen: 2020-01-02T20:17:51+02:00 lastUpdated: 2020-11-02T19:28:35+02:00 @@ -14,7 +14,7 @@ Builds a list, using an iterator function and an initial seed value. ```py def unfold(fn, seed): def fn_generator(val): - while True: + while True: val = fn(val[1]) if val == False: break yield val[0] diff --git a/snippets/union.md b/snippets/union.md index 05d0d9748..adc73cc0c 100644 --- a/snippets/union.md +++ b/snippets/union.md @@ -1,5 +1,5 @@ --- -title: union +title: List union tags: list,beginner firstSeen: 2019-08-21T09:10:39+03:00 lastUpdated: 2020-11-02T19:28:35+02:00 diff --git a/snippets/union_by.md b/snippets/union_by.md index 28c635ec4..08c4d6855 100644 --- a/snippets/union_by.md +++ b/snippets/union_by.md @@ -1,5 +1,5 @@ --- -title: union_by +title: List union based on function tags: list,intermediate firstSeen: 2019-08-21T09:10:39+03:00 lastUpdated: 2020-11-02T19:28:35+02:00 diff --git a/snippets/unique_elements.md b/snippets/unique_elements.md index 6f643e850..92427869d 100644 --- a/snippets/unique_elements.md +++ b/snippets/unique_elements.md @@ -1,5 +1,5 @@ --- -title: unique_elements +title: Unique elements in list tags: list,beginner firstSeen: 2018-10-09T20:01:19+03:00 lastUpdated: 2020-09-15T16:13:06+03:00 diff --git a/snippets/values_only.md b/snippets/values_only.md index b3ac16f2b..0d64462b9 100644 --- a/snippets/values_only.md +++ b/snippets/values_only.md @@ -1,5 +1,5 @@ --- -title: values_only +title: Dictionary values tags: dictionary,list,beginner firstSeen: 2018-04-01T23:56:31+03:00 lastUpdated: 2020-11-02T19:28:35+02:00 diff --git a/snippets/weighted_average.md b/snippets/weighted_average.md index 164d28d93..8339af855 100644 --- a/snippets/weighted_average.md +++ b/snippets/weighted_average.md @@ -1,5 +1,5 @@ --- -title: weighted_average +title: Weighted average tags: math,list,intermediate firstSeen: 2020-10-09T07:00:33+03:00 lastUpdated: 2020-12-24T15:00:53+02:00 diff --git a/snippets/when.md b/snippets/when.md index 17fc3cbcb..b98bc258d 100644 --- a/snippets/when.md +++ b/snippets/when.md @@ -1,5 +1,5 @@ --- -title: when +title: Apply function when true tags: function,intermediate firstSeen: 2020-01-02T20:25:45+02:00 lastUpdated: 2020-11-09T23:56:11+02:00 diff --git a/snippets/words.md b/snippets/words.md index 4986328e8..f04b40ea7 100644 --- a/snippets/words.md +++ b/snippets/words.md @@ -1,5 +1,5 @@ --- -title: words +title: String to words tags: string,regexp,beginner firstSeen: 2020-10-04T00:35:00+03:00 lastUpdated: 2020-11-02T19:28:35+02:00