Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 60de25d

Browse files
Merge pull request #14 from gurungrahul2/patch-1
fixed mistakes
2 parents b706768 + b0d8900 commit 60de25d

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

‎markdown-version/lists.md‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ print(list(x))
2828
```Python
2929
x = ['john','jason','tony']
3030
print(x[0]) # This will john
31-
print(x[0]) # This will jason
32-
print(x[0]) # This will tony
33-
print(x[1])
34-
print(x[2])
31+
print(x[1]) # This will jason
32+
print(x[2]) # This will tony
3533
```
3634

3735
* We use built in python **in** keyword to see if the item exists in the list
@@ -65,10 +63,10 @@ while i < len(list):
6563
```Python
6664
x = [1,2,3,4,5]
6765
x.append([5,6,7,8])
68-
# This print [1,2,3,4,5,[6,7,8,9]]
66+
# This print [1,2,3,4,5,[5,6,7,8]]
6967
#Lets use the extend method on this
7068
x.extend([5,6,7,8,9])
71-
#This will print out [1,2,3,4,5,6,7,8,9]
69+
#This will print out [1,2,3,4,5,5,6,7,8,9]
7270
```
7371
* if want to add one item to the end of the list use append() if you are adding more than one item use extend()
7472
* insert() method is used to add the item to the given position in the list

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /