update lint

This commit is contained in:
Rohit Tanwar
2018-01-16 18:35:58 +05:30
parent 01077dcf5c
commit 81a5dc868c
10 changed files with 32 additions and 24 deletions

View File

@ -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

View File

@ -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),

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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: