Skip to content

Commit 0da57d5

Browse files
committed
fix some print statements and commented results
1 parent 96aeec1 commit 0da57d5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

python-numpy-tutorial.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ print xs[-1] # Negative indices count from the end of the list; prints "2"
183183
xs[2] = 'foo' # Lists can contain elements of different types
184184
print xs # Prints "[3, 1, 'foo']"
185185
xs.append('bar') # Add a new element to the end of the list
186-
print xs # Prints
186+
print xs # Prints "[3, 1, 'foo', 'bar']"
187187
x = xs.pop() # Remove and return the last element of the list
188188
print x, xs # Prints "bar [3, 1, 'foo']"
189189
```
@@ -203,7 +203,7 @@ print nums[:2] # Get a slice from the start to index 2 (exclusive); prints "
203203
print nums[:] # Get a slice of the whole list; prints ["0, 1, 2, 3, 4]"
204204
print nums[:-1] # Slice indices can be negative; prints ["0, 1, 2, 3]"
205205
nums[2:4] = [8, 9] # Assign a new sublist to a slice
206-
print nums # Prints "[0, 1, 8, 8, 4]"
206+
print nums # Prints "[0, 1, 8, 9, 4]"
207207
```
208208
We will see slicing again in the context of numpy arrays.
209209

@@ -385,9 +385,9 @@ We will often define functions to take optional keyword arguments, like this:
385385
```python
386386
def hello(name, loud=False):
387387
if loud:
388-
print 'HELLO, %s' % name.upper()
388+
print 'HELLO, %s!' % name.upper()
389389
else:
390-
print 'Hello, %s!' % name
390+
print 'Hello, %s' % name
391391

392392
hello('Bob') # Prints "Hello, Bob"
393393
hello('Fred', loud=True) # Prints "HELLO, FRED!"

0 commit comments

Comments
 (0)