Skip to content

Commit

Permalink
Language added
Browse files Browse the repository at this point in the history
  • Loading branch information
ramanaditya committed May 22, 2020
1 parent 5f7d6b6 commit 3948ad8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
7 changes: 6 additions & 1 deletion languages/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
# Languages
This folder contains tips and tricks related to the different frequently used and time efficient approaches for a piece of a work.
This folder contains tips and tricks related to the different frequently used and time efficient approaches for a piece of a work.

| Topic | Languages |
| :---: | :---: |
| List | [Python](./python/list.md) |
| Dictionary | [Python](./python/dictionary.md) |
4 changes: 2 additions & 2 deletions languages/python/dictionary.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Some useful piece of Code during programming
# Dictionary: Some useful piece of Code during programming

### Counting the occurrence of elements
```python
Expand All @@ -11,4 +11,4 @@ def occurrence(s: str) -> dict:
"""
d = Counter(s)
return d
```
```
16 changes: 16 additions & 0 deletions languages/python/list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# List: Some useful pieces of Code during programming

## Sorting a list os lists based upon 2nd index or other
```python
def sort_it(arr: list) -> list:
"""
sorted takes 3 arguments
- iterable : list/tuple/string
- key(optional) the key on which you want to sort
- reverse(optional) default is False, make it True for reverse sorting
return a sorted list
"""
return sorted(arr, key = lambda ele: ele[1], reverse = False)

```

0 comments on commit 3948ad8

Please sign in to comment.