Files
30-seconds-of-code/snippets/difference.md
Rohit Tanwar 5b7baf43f8 Fix some bugs
Change lint.py to print the name of file being linted for easy debugging. Also removed a bug from website\main.py
2018-04-12 17:46:30 +05:30

14 lines
267 B
Markdown

### difference
Returns the difference between two iterables.
Use list comprehension to only keep values not contained in `b`
```python
def difference(a, b):
return [item for item in a if item not in b]
```
``` python
difference([1, 2, 3], [1, 2, 4]) # [3]
```