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.