Update snippet titles
This commit is contained in:
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
---
|
||||
title: all_unique
|
||||
title: Check if a list has no duplicates
|
||||
tags: list,beginner
|
||||
firstSeen: 2018-04-01T11:03:09+03:00
|
||||
lastUpdated: 2021-01-07T23:30:28+02:00
|
||||
|
||||
@ -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]
|
||||
```
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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):
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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.
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user