Skip to content

Commit 394d93b

Browse files
authored
Update 09-Inbuilt_functions.md
1 parent 0629654 commit 394d93b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

python/09-Inbuilt_functions.md

+10
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,23 @@ Output
105105
## max/min
106106
* Returns the greatest/smallest item in an iterable or the smallest of two or more arguments.
107107
* It can also be made to make use of key argument as used in sort function
108+
108109
### implementation
110+
109111
```python
112+
110113
list = [1, 4, 3, 5,9,2]
111114
print(max(list)) #returns maximum value of list
112115
print(min(list)) #returns minimum value in the list
113116
print(max(list[2:-2])) #returns max value combined with slicing
114117
print(min(list[4:])
115118
print(max(4,2,3,5))
116119
print(min(7,2,1,8,4))
120+
117121
```
122+
118123
Output
124+
119125
```
120126
9
121127
1
@@ -126,13 +132,17 @@ Output
126132

127133
```
128134

135+
136+
137+
129138
## Reduce
130139
* Reduce is a really useful function for performing some computation on a list and returning the result.
131140
* It applies a rolling computation to sequential pairs of values in a list
132141
>note this not an inbuilt function as such because it needs to be imported from func tools but is pretty useful.
133142

134143
### implementation
135144
```python
145+
136146
#Normal way to find product of elements in a list
137147
product = 1
138148
list = [1, 2, 3, 4]

0 commit comments

Comments
 (0)