Skip to content

Commit 9e01603

Browse files
committed
Merge branch 'gh-pages' of https://github.com/mboisson/python-novice-inflammation into mboisson-gh-pages
2 parents b925981 + 48c995c commit 9e01603

File tree

1 file changed

+0
-55
lines changed

1 file changed

+0
-55
lines changed

01-numpy.md

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -156,28 +156,6 @@ Since `weight_lb` doesn't "remember" where its value came from,
156156
it isn't automatically updated when `weight_kg` changes.
157157
This is different from the way spreadsheets work.
158158

159-
> ## What's inside the box? {.challenge}
160-
>
161-
> Draw diagrams showing what variables refer to what values after each statement in the following program:
162-
>
163-
> ~~~ {.python}
164-
> weight = 70.5
165-
> age = 35
166-
> # Take a trip to the planet Neptune
167-
> weight = weight * 1.14
168-
> age = age + 20
169-
> ~~~
170-
171-
> ## Sorting out references {.challenge}
172-
>
173-
> What does the following program print out?
174-
>
175-
> ~~~ {.python}
176-
> first, second = 'Grace', 'Hopper'
177-
> third, fourth = second, first
178-
> print third, fourth
179-
> ~~~
180-
181159
Just as we can assign a single value to a variable, we can also assign an array of values
182160
to a variable using the same syntax. Let's re-run `numpy.loadtxt` and save its result:
183161

@@ -332,39 +310,6 @@ small is:
332310
[ 2. 2. 1. 1.]]
333311
~~~
334312

335-
> ## Slicing strings {.challenge}
336-
>
337-
> A section of an array is called a **slice**.
338-
> We can take slices of character strings as well:
339-
>
340-
> ~~~ {.python}
341-
> element = 'oxygen'
342-
> print 'first three characters:', element[0:3]
343-
> print 'last three characters:', element[3:6]
344-
> ~~~
345-
>
346-
> ~~~ {.output}
347-
> first three characters: oxy
348-
> last three characters: gen
349-
> ~~~
350-
>
351-
> What is the value of `element[:4]`?
352-
> What about `element[4:]`?
353-
> Or `element[:]`?
354-
>
355-
> What is `element[-1]`?
356-
> What is `element[-2]`?
357-
> Given those answers,
358-
> explain what `element[1:-1]` does.
359-
360-
> ## Thin slices {.challenge}
361-
>
362-
> The expression `element[3:3]` produces an **empty string**,
363-
> i.e., a string that contains no characters.
364-
> If `data` holds our array of patient data,
365-
> what does `data[3:3, 4:4]` produce?
366-
> What about `data[3:3, :]`?
367-
368313
Arrays also know how to perform common mathematical operations on their values.
369314
The simplest operations with data are arithmetic:
370315
add, subtract, multiply, and divide.

0 commit comments

Comments
 (0)