diff options
author | Geoff Liu <cangming.liu@gmail.com> | 2015-04-30 23:31:16 -0600 |
---|---|---|
committer | Geoff Liu <cangming.liu@gmail.com> | 2015-04-30 23:31:16 -0600 |
commit | 7f1c4293e448f9ff1e14587c189dd672ad8c19e5 (patch) | |
tree | 2d3c1a13e5e0c349c234fa832f9052351f055614 /python.html.markdown | |
parent | f4beb3bea956775664c64cb8f1973a816fbac224 (diff) | |
parent | 5ebe2dcb6eeaf7e34daf07f76dcfa2403f05a332 (diff) |
Merge pull request #1076 from rinoc/master
Fix Python typo.
Diffstat (limited to 'python.html.markdown')
-rw-r--r-- | python.html.markdown | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/python.html.markdown b/python.html.markdown index 7281a330..ace3f794 100644 --- a/python.html.markdown +++ b/python.html.markdown @@ -46,7 +46,7 @@ to Python 2.x. For Python 3.x, take a look at the [Python 3 tutorial](http://lea 2.0 # This is a float 11.0 / 4.0 # => 2.75 ahhh...much better -# Result of integer division truncated down both for positive and negative. +# Result of integer division truncated down both for positive and negative. 5 // 3 # => 1 5.0 // 3.0 # => 1.0 # works on floats too -5 // 3 # => -2 @@ -191,14 +191,14 @@ li[2:] # => [4, 3] li[:3] # => [1, 2, 4] # Select every second entry li[::2] # =>[1, 4] -# Revert the list +# Reverse a copy of the list li[::-1] # => [3, 4, 2, 1] # Use any combination of these to make advanced slices # li[start:end:step] # Remove arbitrary elements from a list with "del" del li[2] # li is now [1, 2, 3] - +r # You can add lists li + other_li # => [1, 2, 3, 4, 5, 6] # Note: values for li and for other_li are not modified. @@ -439,14 +439,14 @@ def pass_all_the_args(*args, **kwargs): print varargs(*args) print keyword_args(**kwargs) -# Function Scope +# Function Scope x = 5 def setX(num): # Local var x not the same as global variable x x = num # => 43 print x # => 43 - + def setGlobalX(num): global x print x # => 5 |