We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents b706768 + b0d8900 commit 60de25dCopy full SHA for 60de25d
markdown-version/lists.md
@@ -28,10 +28,8 @@ print(list(x))
28
```Python
29
x = ['john','jason','tony']
30
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])
+print(x[1]) # This will jason
+print(x[2]) # This will tony
35
```
36
37
* We use built in python **in** keyword to see if the item exists in the list
@@ -65,10 +63,10 @@ while i < len(list):
65
63
66
64
x = [1,2,3,4,5]
67
x.append([5,6,7,8])
68
-# This print [1,2,3,4,5,[6,7,8,9]]
+# This print [1,2,3,4,5,[5,6,7,8]]
69
#Lets use the extend method on this
70
x.extend([5,6,7,8,9])
71
-#This will print out [1,2,3,4,5,6,7,8,9]
+#This will print out [1,2,3,4,5,5,6,7,8,9]
72
73
* if want to add one item to the end of the list use append() if you are adding more than one item use extend()
74
* insert() method is used to add the item to the given position in the list
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments