update lint
This commit is contained in:
@ -5,6 +5,8 @@ Chunks an array into smaller lists of a specified size.
|
||||
Uses `range` to create a list of desired size. Then use `map` on this list and fill it with splices of `arr`.
|
||||
|
||||
```python
|
||||
|
||||
|
||||
from math import ceil
|
||||
|
||||
|
||||
|
||||
@ -5,6 +5,8 @@ Counts the occurrences of a value in an list.
|
||||
Uses the `reduce` functin from built-in module `functools` to increment a counter each time you encounter the specific value inside the list.
|
||||
|
||||
```python
|
||||
|
||||
|
||||
def count_occurences(arr, val):
|
||||
return reduce(
|
||||
(lambda x, y: x + 1 if y == val and type(y) == type(val) else x + 0),
|
||||
|
||||
@ -5,6 +5,8 @@ Retuns `number` of vowels in provided `string`.
|
||||
Use a regular expression to count the number of vowels `(A, E, I, O, U)` in a string.
|
||||
|
||||
```python
|
||||
|
||||
|
||||
import re
|
||||
|
||||
|
||||
|
||||
@ -7,6 +7,8 @@ The `helperGcdfunction` uses recursion. Base case is when `y` equals `0`. In thi
|
||||
Uses the reduce function from the inbuilt module `functools`. Also defines a method `spread` for javascript like spreading of lists.
|
||||
|
||||
```python
|
||||
|
||||
|
||||
from functools import reduce
|
||||
|
||||
|
||||
|
||||
@ -7,6 +7,8 @@ Use the `greatest common divisor (GCD)` formula and the fact that `lcm(x,y) = x
|
||||
Uses `reduce` function from the inbuilt module `functools`. Also defines a method `spread` for javascript like spreading of lists.
|
||||
|
||||
```python
|
||||
|
||||
|
||||
from functools import reduce
|
||||
|
||||
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
Implements javascript's spread syntax as a function. Flattens the list(non-deep) and returns an list.
|
||||
|
||||
```python
|
||||
|
||||
|
||||
def spread(arg):
|
||||
ret = []
|
||||
for i in arg:
|
||||
|
||||
Reference in New Issue
Block a user