@@ -658,59 +658,6 @@ the graphs will actually be squeezed together more closely.)
658658> If you ever see Python code online using a NumPy function with ` np `
659659> (for example, ` np.loadtxt(...) ` ), it's because they've used this shortcut.
660660
661- > ## Check your understanding {.challenge}
662- >
663- > Draw diagrams showing what variables refer to what values after each statement in the following program:
664- >
665- > ~~~ {.python}
666- > mass = 47.5
667- > age = 122
668- > mass = mass * 2.0
669- > age = age - 20
670- > ~~~
671-
672- > ## Sorting out references {.challenge}
673- >
674- > What does the following program print out?
675- >
676- > ~~~ {.python}
677- > first, second = 'Grace', 'Hopper'
678- > third, fourth = second, first
679- > print third, fourth
680- > ~~~
681-
682- > ## Slicing strings {.challenge}
683- >
684- > A section of an array is called a [slice](reference.html#slice).
685- > We can take slices of character strings as well:
686- >
687- > ~~~ {.python}
688- > element = 'oxygen'
689- > print 'first three characters:', element[0:3]
690- > print 'last three characters:', element[3:6]
691- > ~~~
692- >
693- > ~~~ {.output}
694- > first three characters: oxy
695- > last three characters: gen
696- > ~~~
697- >
698- > What is the value of `element[:4]`?
699- > What about `element[4:]`?
700- > Or `element[:]`?
701- >
702- > What is `element[-1]`?
703- > What is `element[-2]`?
704- > Given those answers,
705- > explain what `element[1:-1]` does.
706-
707- > ## Thin slices {.challenge}
708- >
709- > The expression `element[3:3]` produces an [empty string](reference.html#empty-string),
710- > i.e., a string that contains no characters.
711- > If `data` holds our array of patient data,
712- > what does `data[3:3, 4:4]` produce?
713- > What about `data[3:3, :]`?
714661
715662> ## Check your understanding: plot scaling {.challenge}
716663>
0 commit comments