Update snippet titles
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: flatten
|
title: Flatten list
|
||||||
tags: list,intermediate
|
tags: list,intermediate
|
||||||
firstSeen: 2019-09-19T15:46:10+03:00
|
firstSeen: 2019-09-19T15:46:10+03:00
|
||||||
lastUpdated: 2020-11-02T19:27:53+02:00
|
lastUpdated: 2020-11-02T19:27:53+02:00
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: for_each
|
title: Execute function for each list element
|
||||||
tags: list,beginner
|
tags: list,beginner
|
||||||
firstSeen: 2020-03-15T12:54:08+02:00
|
firstSeen: 2020-03-15T12:54:08+02:00
|
||||||
lastUpdated: 2020-09-15T16:13:06+03:00
|
lastUpdated: 2020-09-15T16:13:06+03:00
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: for_each_right
|
title: Execute function for each list element in reverse
|
||||||
tags: list,beginner
|
tags: list,beginner
|
||||||
firstSeen: 2020-03-15T12:54:08+02:00
|
firstSeen: 2020-03-15T12:54:08+02:00
|
||||||
lastUpdated: 2020-09-15T16:13:06+03:00
|
lastUpdated: 2020-09-15T16:13:06+03:00
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: frequencies
|
title: Value frequencies
|
||||||
tags: list,intermediate
|
tags: list,intermediate
|
||||||
firstSeen: 2020-03-15T12:54:08+02:00
|
firstSeen: 2020-03-15T12:54:08+02:00
|
||||||
lastUpdated: 2020-11-02T19:27:53+02:00
|
lastUpdated: 2020-11-02T19:27:53+02:00
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: from_iso_date
|
title: Date from ISO format
|
||||||
tags: date,intermediate
|
tags: date,intermediate
|
||||||
firstSeen: 2020-10-28T16:20:04+02:00
|
firstSeen: 2020-10-28T16:20:04+02:00
|
||||||
lastUpdated: 2021-01-07T23:30:28+02:00
|
lastUpdated: 2021-01-07T23:30:28+02:00
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: gcd
|
title: Greatest common divisor
|
||||||
tags: math,beginner
|
tags: math,beginner
|
||||||
firstSeen: 2018-01-08T16:26:35+02:00
|
firstSeen: 2018-01-08T16:26:35+02:00
|
||||||
lastUpdated: 2020-09-15T16:13:06+03:00
|
lastUpdated: 2020-09-15T16:13:06+03:00
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
---
|
---
|
||||||
title: geometric_progression
|
title: Geometric progression
|
||||||
tags: math,list,intermediate
|
tags: math,list,intermediate
|
||||||
firstSeen: 2020-10-04T12:19:28+03:00
|
firstSeen: 2020-10-04T12:19:28+03:00
|
||||||
lastUpdated: 2020-11-02T19:28:05+02: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`.
|
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.
|
- 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 second argument, `start`, to use a default value of `1`.
|
||||||
- Omit the third argument, `step`, to use a default value of `2`.
|
- Omit the third argument, `step`, to use a default value of `2`.
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: get
|
title: Get nested value
|
||||||
tags: dictionary,list,intermediate
|
tags: dictionary,list,intermediate
|
||||||
firstSeen: 2020-10-28T12:21:39+02:00
|
firstSeen: 2020-10-28T12:21:39+02:00
|
||||||
lastUpdated: 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.
|
- Apply `operator.getitem()` for each key in `selectors`, retrieving the value to be used as the iteratee for the next iteration.
|
||||||
|
|
||||||
```py
|
```py
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
from operator import getitem
|
from operator import getitem
|
||||||
|
|
||||||
def get(d, selectors):
|
def get(d, selectors):
|
||||||
@ -23,7 +23,7 @@ users = {
|
|||||||
'freddy': {
|
'freddy': {
|
||||||
'name': {
|
'name': {
|
||||||
'first': 'fred',
|
'first': 'fred',
|
||||||
'last': 'smith'
|
'last': 'smith'
|
||||||
},
|
},
|
||||||
'postIds': [1, 2, 3]
|
'postIds': [1, 2, 3]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: group_by
|
title: Group list elements
|
||||||
tags: list,dictionary,intermediate
|
tags: list,dictionary,intermediate
|
||||||
firstSeen: 2019-08-20T13:29:00+03:00
|
firstSeen: 2019-08-20T13:29:00+03:00
|
||||||
lastUpdated: 2020-11-02T19:28:05+02:00
|
lastUpdated: 2020-11-02T19:28:05+02:00
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: hamming_distance
|
title: Hamming distance
|
||||||
tags: math,intermediate
|
tags: math,intermediate
|
||||||
firstSeen: 2021-01-17T13:04:06+02:00
|
firstSeen: 2021-01-17T13:04:06+02:00
|
||||||
lastUpdated: 2021-02-18T14:22:25+02:00
|
lastUpdated: 2021-02-18T14:22:25+02:00
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: has_duplicates
|
title: Check for duplicates in list
|
||||||
tags: list,beginner
|
tags: list,beginner
|
||||||
firstSeen: 2018-04-01T11:03:09+03:00
|
firstSeen: 2018-04-01T11:03:09+03:00
|
||||||
lastUpdated: 2020-11-02T19:28:05+02:00
|
lastUpdated: 2020-11-02T19:28:05+02:00
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: have_same_contents
|
title: Check lists have same contents
|
||||||
tags: list,intermediate
|
tags: list,intermediate
|
||||||
firstSeen: 2020-03-15T12:54:08+02:00
|
firstSeen: 2020-03-15T12:54:08+02:00
|
||||||
lastUpdated: 2020-11-02T19:28:05+02:00
|
lastUpdated: 2020-11-02T19:28:05+02:00
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: head
|
title: List head
|
||||||
tags: list,beginner
|
tags: list,beginner
|
||||||
firstSeen: 2019-08-20T14:08:52+03:00
|
firstSeen: 2019-08-20T14:08:52+03:00
|
||||||
lastUpdated: 2020-09-15T16:13:06+03:00
|
lastUpdated: 2020-09-15T16:13:06+03:00
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: hex_to_rgb
|
title: Hex to RGB
|
||||||
tags: string,math,intermediate
|
tags: string,math,intermediate
|
||||||
firstSeen: 2020-09-13T01:08:21+03:00
|
firstSeen: 2020-09-13T01:08:21+03:00
|
||||||
lastUpdated: 2020-09-15T16:13:06+03:00
|
lastUpdated: 2020-09-15T16:13:06+03:00
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: in_range
|
title: Number in range
|
||||||
tags: math,beginner
|
tags: math,beginner
|
||||||
firstSeen: 2019-08-20T13:41:40+03:00
|
firstSeen: 2019-08-20T13:41:40+03:00
|
||||||
lastUpdated: 2020-09-15T16:13:06+03:00
|
lastUpdated: 2020-09-15T16:13:06+03:00
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: includes_all
|
title: List includes all values
|
||||||
tags: list,intermediate
|
tags: list,intermediate
|
||||||
firstSeen: 2020-03-15T12:54:08+02:00
|
firstSeen: 2020-03-15T12:54:08+02:00
|
||||||
lastUpdated: 2020-11-02T19:28:05+02:00
|
lastUpdated: 2020-11-02T19:28:05+02:00
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: includes_any
|
title: List includes any values
|
||||||
tags: list,intermediate
|
tags: list,intermediate
|
||||||
firstSeen: 2020-03-15T12:54:08+02:00
|
firstSeen: 2020-03-15T12:54:08+02:00
|
||||||
lastUpdated: 2020-11-02T19:28:05+02:00
|
lastUpdated: 2020-11-02T19:28:05+02:00
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: index_of_all
|
title: All indexes of value
|
||||||
tags: list,intermediate
|
tags: list,intermediate
|
||||||
firstSeen: 2020-10-11T13:40:42+03:00
|
firstSeen: 2020-10-11T13:40:42+03:00
|
||||||
lastUpdated: 2020-10-11T13:45:19+03:00
|
lastUpdated: 2020-10-11T13:45:19+03:00
|
||||||
@ -16,5 +16,5 @@ def index_of_all(lst, value):
|
|||||||
|
|
||||||
```py
|
```py
|
||||||
index_of_all([1, 2, 1, 4, 5, 1], 1) # [0, 2, 5]
|
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) # []
|
||||||
```
|
```
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: initial
|
title: List without last element
|
||||||
tags: list,beginner
|
tags: list,beginner
|
||||||
firstSeen: 2019-08-20T14:08:52+03:00
|
firstSeen: 2019-08-20T14:08:52+03:00
|
||||||
lastUpdated: 2020-11-02T19:28:05+02:00
|
lastUpdated: 2020-11-02T19:28:05+02:00
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: initialize_2d_list
|
title: Initialize 2D list
|
||||||
tags: list,intermediate
|
tags: list,intermediate
|
||||||
firstSeen: 2019-10-25T10:11:51+03:00
|
firstSeen: 2019-10-25T10:11:51+03:00
|
||||||
lastUpdated: 2020-11-02T19:28:05+02:00
|
lastUpdated: 2020-11-02T19:28:05+02:00
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: initialize_list_with_range
|
title: Initialize list with range
|
||||||
tags: list,beginner
|
tags: list,beginner
|
||||||
firstSeen: 2019-08-20T15:21:41+03:00
|
firstSeen: 2019-08-20T15:21:41+03:00
|
||||||
lastUpdated: 2020-11-02T19:28:05+02:00
|
lastUpdated: 2020-11-02T19:28:05+02:00
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: initialize_list_with_values
|
title: Initialize list with values
|
||||||
tags: list,beginner
|
tags: list,beginner
|
||||||
firstSeen: 2019-08-20T14:12:06+03:00
|
firstSeen: 2019-08-20T14:12:06+03:00
|
||||||
lastUpdated: 2020-11-02T19:28:05+02:00
|
lastUpdated: 2020-11-02T19:28:05+02:00
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: intersection
|
title: List intersection
|
||||||
tags: list,beginner
|
tags: list,beginner
|
||||||
firstSeen: 2019-08-20T15:14:26+03:00
|
firstSeen: 2019-08-20T15:14:26+03:00
|
||||||
lastUpdated: 2020-11-02T19:28:05+02:00
|
lastUpdated: 2020-11-02T19:28:05+02:00
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: intersection_by
|
title: List intersection based on function
|
||||||
tags: list,function,intermediate
|
tags: list,function,intermediate
|
||||||
firstSeen: 2019-08-20T15:16:27+03:00
|
firstSeen: 2019-08-20T15:16:27+03:00
|
||||||
lastUpdated: 2020-11-02T19:28:05+02:00
|
lastUpdated: 2020-11-02T19:28:05+02:00
|
||||||
|
|||||||
Reference in New Issue
Block a user