Skip to content

Commit 0c11192

Browse files
authored
Update Insertdeleteupdateonlist.md
1 parent fb10328 commit 0c11192

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Data_Structure_In_Python/List/Insertdeleteupdateonlist.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ num.insert(10,8)
9090
print(num)
9191
#Result:[1,3,4,7,8]
9292
```
93-
- you can also use negative index for inserting element
93+
**you can also use negative index for inserting element**
9494
- similarly if you have give negative index which is not present in current list the item will added at 0th index
9595

9696
Example:
@@ -103,7 +103,7 @@ print(num)
103103
#Result:[8,1,3,4,7]
104104
```
105105
### 3.extend() :person_fencing:
106-
- **extend()** method add the number of list element to the end of the current list
106+
**extend()** method add the number of list element to the end of the current list
107107

108108
Syntax:
109109
```python
@@ -122,13 +122,13 @@ print(num1)
122122

123123
## 2.Delete :red_circle:
124124

125-
- There are different ways to delete element from the list.
125+
There are different ways to delete element from the list.
126126
1. del
127127
2. pop()
128128
3. remove()
129129

130130
### 1.del :no_entry:
131-
- if you removed item using del statement you cant use them for further process.
131+
if you removed item using del statement you cant use them for further process.
132132

133133
Syntax:
134134
```python
@@ -156,6 +156,7 @@ del number
156156
print(number)
157157

158158
#Result:error because number list is deleted
159+
#ERROR:name 'number' is not defined
159160
```
160161

161162
### 2.pop() :no_entry_sign:
@@ -223,7 +224,7 @@ color.remove("black")
223224
````
224225

225226
## 3.Update :drum:
226-
- for updating the element value
227+
For updating the element value
227228

228229
Syntax:
229230
```python
@@ -232,10 +233,13 @@ list[index]="new value"
232233
Example:
233234
```python
234235
color=["blue","green","red"]
236+
235237
#update blue with *black*
236238
color[0]="black"
239+
237240
#print new updated list
238241
print(color)
242+
239243
#Result:["black","green","red"]
240244
```
241245

0 commit comments

Comments
 (0)