Skip to content

Commit 355773f

Browse files
authored
Update 09-Inbuilt_functions.md
1 parent 1528efb commit 355773f

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

python/09-Inbuilt_functions.md

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<h1 align="center"><a href="#"> Strings </a></h1>
1+
<h1 align="center"><a href="#"> Inbuilt Functions </a></h1>
22

33
* The Python interpreter has a number of functions and types built into it that are always available.
4-
* There is no need to import modules extra in order to use them.
4+
* There is no need to import any extra modules in order to use them.
55
* A few functions that we will be covering here are-
66
* Map
77
* Filter
@@ -10,7 +10,7 @@
1010
* Reduce
1111

1212
## Map
13-
* It iterates through all the elements of a iterable and applies some specific funtion to each element of that iterable.
13+
* It iterates through all the elements of an iterable and applies some specific function to each element of that iterable.
1414
* With multiple iterables, the iterator stops when the shortest iterable is exhausted
1515

1616
### syntax
@@ -65,7 +65,7 @@ Output
6565
## Sort/Sorted
6666
* Python lists have a built-in sort() method that modifies the list in-place and a sorted() built-in function that builds a new sorted list from an iterable
6767
* There are many ways to use them to sort data and there doesn't appear to be a single, central place in the various manuals describing them
68-
* The key difference between both is that sorted returns a new list whereas sort chsnges the original list itself.
68+
* The key difference between both is that sorted returns a new list whereas sort changes the original list itself.
6969

7070
### syntax
7171
```python
@@ -78,7 +78,7 @@ sorted(list,key=<insert the key>)#sort in ascending order of the key set
7878
```python
7979

8080
a = [5, 2, 3, 1, 4]
81-
a.sort()# .sort() function is specific to lists
81+
a.sort() #sort() function is specific to lists
8282
print(a)
8383

8484
chir={2: 'D', 1: 'B', 4: 'B', 3: 'E', 5: 'A'}# declaring a dictionary
@@ -103,14 +103,14 @@ Output
103103
104104
```
105105
## max/min
106-
* Return the greatets/smallest item in an iterable or the smallest of two or more arguments.
106+
* 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
108108
### implementation
109109
```python
110110
list = [1, 4, 3, 5,9,2]
111111
print(max(list)) #returns maximum value of list
112112
print(min(list)) #returns minimum value in the list
113-
print(max(list[2:-2])) #returns max value compined with slicing
113+
print(max(list[2:-2])) #returns max value combined with slicing
114114
print(min(list[4:])
115115
print(max(4,2,3,5))
116116
print(min(7,2,1,8,4))
@@ -121,13 +121,15 @@ Output
121121
1
122122
5
123123
9
124+
5
125+
1
124126

125127
```
126128

127129
## Reduce
128130
* Reduce is a really useful function for performing some computation on a list and returning the result.
129131
* It applies a rolling computation to sequential pairs of values in a list
130-
>note this not a inbuilt function as such because it needs to be imported from func tools but is pretty useful.
132+
>note this not an inbuilt function as such because it needs to be imported from func tools but is pretty useful.
131133

132134
### implementation
133135
```python

0 commit comments

Comments
 (0)