Skip to content

Commit

Permalink
Merge pull request #248 from knakaj/issue_247
Browse files Browse the repository at this point in the history
fixed issue#247
  • Loading branch information
bnmnetp authored Jul 11, 2022
2 parents 7d75694 + 867c4e6 commit 0f3a6a8
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pretext/Functions/Functionsthatreturnvalues.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ print(max(3 * 11, 5 ** 3, 512 - 9, 1024 ** 0))
125, and 1. Note that <c>max</c> also works on lists of values.</p>
<p>Furthermore, functions like <c>range</c>, <c>int</c>, <c>abs</c> all return values that
can be used to build more complex expressions.</p>
<p xml:id="functions_index-1">So an important difference between these functions and one like <c>drawSquare</c> is that
<p xml:id="functions_index_1">So an important difference between these functions and one like <c>drawSquare</c> is that
<c>drawSquare</c> was not executed because we wanted it to compute a value &#x2014; on the contrary,
we wrote <c>drawSquare</c> because we wanted it to execute a sequence of steps that caused
the turtle to draw a specific shape.</p>
Expand Down
2 changes: 1 addition & 1 deletion pretext/Functions/Variablesandparametersarelocal.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ result = badsquare(10)
print(result)
</input>
</program>
<p xml:id="functions_index-1">Although the <c>badsquare</c> function works, it is silly and poorly written. We have done it here to illustrate
<p xml:id="functions-index-1">Although the <c>badsquare</c> function works, it is silly and poorly written. We have done it here to illustrate
an important rule about how variables are looked up in Python.
First, Python looks at the variables that are defined as local variables in
the function. We call this the <term>local scope</term>. If the variable name is not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
and location using a layout manager. The image below shows examples of the
four types of widget <q>containers</q>. The <q>containers</q> in this example used a
<c>grid</c> layout manager on a 2x2 grid.</p>
<figure align="center" xml:id="id1">
<figure align="center" xml:id="id_1">
<caption xmlns:c="https://www.sphinx-doc.org/" xmlns:changeset="https://www.sphinx-doc.org/" xmlns:citation="https://www.sphinx-doc.org/" xmlns:cpp="https://www.sphinx-doc.org/" xmlns:index="https://www.sphinx-doc.org/" xmlns:js="https://www.sphinx-doc.org/" xmlns:math="https://www.sphinx-doc.org/" xmlns:py="https://www.sphinx-doc.org/" xmlns:rst="https://www.sphinx-doc.org/" xmlns:std="https://www.sphinx-doc.org/">Examples of grouping widgets</caption>
<image source="GUIandEventDrivenProgramming/Figures/Grouping_examples.png" width="50%"/>
</figure>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<p>Step 1: Make sure you have a reasonable GUI design and implementation plan
before you start coding. Draw a sketch of your initial design on paper
and consider how a user will interact with your program.</p>
<figure align="center" xml:id="id1">
<figure align="center" xml:id="id-1">
<caption xmlns:c="https://www.sphinx-doc.org/" xmlns:changeset="https://www.sphinx-doc.org/" xmlns:citation="https://www.sphinx-doc.org/" xmlns:cpp="https://www.sphinx-doc.org/" xmlns:index="https://www.sphinx-doc.org/" xmlns:js="https://www.sphinx-doc.org/" xmlns:math="https://www.sphinx-doc.org/" xmlns:py="https://www.sphinx-doc.org/" xmlns:rst="https://www.sphinx-doc.org/" xmlns:std="https://www.sphinx-doc.org/">Initial design of a Whack-a-mole game</caption>
<image source="GUIandEventDrivenProgramming/Figures/Whack_a_mole_design.png" width="50%"/>
</figure>
Expand Down
8 changes: 4 additions & 4 deletions pretext/IntroRecursion/CalculatingtheSumofaListofNumbers.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ print(listsum([1,3,5,7,9]))
problem from adding a list to adding pairs of numbers, we could rewrite
the list as a fully parenthesized expression. Such an expression looks
like this:</p>
<math_block docname="IntroRecursion/CalculatingtheSumofaListofNumbers" label="True" nowrap="False" number="True" xml:space="preserve">((((1 + 3) + 5) + 7) + 9)
<math_block docname="IntroRecursion/CalculatingtheSumofaListofNumbers" label1="True" nowrap="False" number="True" xml:space="preserve">((((1 + 3) + 5) + 7) + 9)

</math_block>
<p>We can also parenthesize
the expression the other way around,</p>
<math_block docname="IntroRecursion/CalculatingtheSumofaListofNumbers" label="True" nowrap="False" number="True" xml:space="preserve">(1 + (3 + (5 + (7 + 9))))</math_block>
<math_block docname="IntroRecursion/CalculatingtheSumofaListofNumbers" label2="True" nowrap="False" number="True" xml:space="preserve">(1 + (3 + (5 + (7 + 9))))</math_block>
<p>Notice that the innermost set of
parentheses, <math>(7 + 9)</math>, is a problem that we can solve without a
loop or any special constructs. In fact, we can use the following
sequence of simplifications to compute a final sum.</p>
<math_block docname="IntroRecursion/CalculatingtheSumofaListofNumbers" label="True" nowrap="False" number="True" xml:space="preserve">total = \ (1 + (3 + (5 + (7 + 9)))) \\
<math_block docname="IntroRecursion/CalculatingtheSumofaListofNumbers" label3="True" nowrap="False" number="True" xml:space="preserve">total = \ (1 + (3 + (5 + (7 + 9)))) \\
total = \ (1 + (3 + (5 + 16))) \\
total = \ (1 + (3 + 21)) \\
total = \ (1 + 24) \\
Expand All @@ -46,7 +46,7 @@ total = \ 25</math_block>
the sum of the list <c>numList</c> is the sum of the first element of the
list (<c>numList[0]</c>), and the sum of the numbers in the rest of the
list (<c>numList[1:]</c>). To state it in a functional form:</p>
<math_block docname="IntroRecursion/CalculatingtheSumofaListofNumbers" label="True" nowrap="False" number="True" xml:space="preserve"> listSum(numList) = first(numList) + listSum(rest(numList))
<math_block docname="IntroRecursion/CalculatingtheSumofaListofNumbers" label4="True" nowrap="False" number="True" xml:space="preserve"> listSum(numList) = first(numList) + listSum(rest(numList))
\label{eqn:listsum}</math_block>
<p>In this equation <math>first(numList)</math> returns the first element of
the list and <math>rest(numList)</math> returns a list of everything but
Expand Down
2 changes: 1 addition & 1 deletion pretext/Lists/ListValues.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ newlist = [ numbers, vocabulary ]
print(newlist)
</input>
</program>
<p xml:id="lists_accessing-elements" names="accessing-elements">
<p xml:id="lists_accessing_elements" names="accessing-elements">
<term>Check your understanding</term>
</p>
<exercise label="test_question9_1_1">
Expand Down
2 changes: 1 addition & 1 deletion pretext/MoreAboutIteration/RandomlyWalkingTurtles.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ wn.exitonclick()
that if you ever need to write a similar program, you can reuse this function
with confidence the next time you need it. Breaking up this
program into a couple of parts is another example of functional decomposition.</p>
<p xml:id="more-about-iteration_index-0">
<p xml:id="more-about-iteration-index-0">
<term>Check your understanding</term>
</p>
<exercise label="test_question7_3_1">
Expand Down

0 comments on commit 0f3a6a8

Please sign in to comment.