summaryrefslogtreecommitdiffhomepage
path: root/python3.html.markdown
diff options
context:
space:
mode:
authorbk2dcradle <ankitsultana@gmail.com>2016-01-05 13:34:10 +0530
committerbk2dcradle <ankitsultana@gmail.com>2016-01-05 13:34:10 +0530
commit0e3ed9579b296e276741f06afe8e0a9834672b9e (patch)
treed01a82820ee8a7fb41583cdbf9119583d3fe8004 /python3.html.markdown
parenta5730e4ab931b8355704d35ee08acef75435bd83 (diff)
parent4dc5eeda5528047ece4f5798cff6961b0bc21dcb (diff)
Reset to Adambard's
Diffstat (limited to 'python3.html.markdown')
-rw-r--r--python3.html.markdown7
1 files changed, 3 insertions, 4 deletions
diff --git a/python3.html.markdown b/python3.html.markdown
index 2398e7ac..8cc03320 100644
--- a/python3.html.markdown
+++ b/python3.html.markdown
@@ -224,8 +224,8 @@ li.remove(2) # Raises a ValueError as 2 is not in the list
# Insert an element at a specific index
li.insert(1, 2) # li is now [1, 2, 3] again
-# Get the index of the first item found
-li.index(2) # => 3
+# Get the index of the first item found matching the argument
+li.index(2) # => 1
li.index(4) # Raises a ValueError as 4 is not in the list
# You can add lists
@@ -425,7 +425,6 @@ by step. If step is not indicated, the default value is 1.
prints:
4
6
- 8
"""
for i in range(4, 8, 2):
print(i)
@@ -689,7 +688,7 @@ i.age # => raises an AttributeError
# You can import modules
import math
-print(math.sqrt(16)) # => 4
+print(math.sqrt(16)) # => 4.0
# You can get specific functions from a module
from math import ceil, floor