Skip to content

Commit 82357b2

Browse files
committed
Add 'consider this code' intro; code-style, em-dash
1 parent 550f902 commit 82357b2

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

_episodes/06-func.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -825,8 +825,8 @@ readable code!
825825
>
826826
> Write a function `rescale` that takes an array as input
827827
> and returns a corresponding array of values scaled to lie in the range 0.0 to 1.0.
828-
> (Hint: If $L$ and $H$ are the lowest and highest values in the original array,
829-
> then the replacement for a value $v$ should be $(v-L) / (H-L)$.)
828+
> (Hint: If `L` and `H` are the lowest and highest values in the original array,
829+
> then the replacement for a value `v` should be `(v-L) / (H-L)`.)
830830
>
831831
> > ## Challenge
832832
> > ~~~
@@ -867,7 +867,7 @@ readable code!
867867
868868
> ## Defining Defaults
869869
>
870-
> Rewrite the `rescale` function so that it scales data to lie between 0.0 and 1.0 by default,
870+
> Rewrite the `rescale` function so that it scales data to lie between `0.0` and `1.0` by default,
871871
> but will allow the caller to specify lower and upper bounds if they want.
872872
> Compare your implementation to your neighbor's:
873873
> do the two functions always behave the same way?
@@ -888,7 +888,7 @@ readable code!
888888
889889
> ## Variables Inside and Outside Functions
890890
>
891-
> What does the following piece of code display when run - and why?
891+
> What does the following piece of code display when run --- and why?
892892
>
893893
> ~~~
894894
> f = 0
@@ -970,12 +970,7 @@ readable code!
970970
971971
> ## The Old Switcheroo
972972
>
973-
> Which of the following would be printed if you were to run this code? Why did you pick this answer?
974-
>
975-
> 1. `7 3`
976-
> 2. `3 7`
977-
> 3. `3 3`
978-
> 4. `7 7`
973+
> Consider this code:
979974
>
980975
> ~~~
981976
> a = 3
@@ -991,6 +986,14 @@ readable code!
991986
> print(a, b)
992987
> ~~~
993988
> {: .python}
989+
>
990+
> Which of the following would be printed if you were to run this code? Why did you pick this answer?
991+
>
992+
> 1. `7 3`
993+
> 2. `3 7`
994+
> 3. `3 3`
995+
> 4. `7 7`
996+
>
994997
> > ## Solution
995998
> > `3, 7` is correct. Initially `a` has a value of 3 and `b` has a value of 7.
996999
> > When the swap function is called, it creates local variables (also called

0 commit comments

Comments
 (0)