Commit 2f891d79 authored by marijane white's avatar marijane white Committed by Maxim Belkin

03-loop.md: fix 'Computing the Value of a Polynomial' exercise (#757)

The Output block in this exercise contains two assignments to the variable `y`, which neither looks like an Output nor does it follow from the preceding Python block when run.

I believe the first assignment to `y` was intended to be part of the Python block, and I also believe the intent was to print the value of `y`, which is 97, instead of assigning 97 to it in the Output block.

This commit does the following:
- moves the first `y` assignment from the Output block into the Python block
- adds a `print(y)` statement to the end of the Python block
- removes the assignment from the `y = 97` line, so that the Output block matches the output of the edited Python block when it is run.
parent 4f03b177
......@@ -390,12 +390,13 @@ so we should always use it when we can.
> ~~~
> x = 5
> coefs = [2, 4, 3]
> y = coefs[0] * x**0 + coefs[1] * x**1 + coefs[2] * x**2
> print(y)
> ~~~
> {: .language-python}
>
> ~~~
> y = coefs[0] * x**0 + coefs[1] * x**1 + coefs[2] * x**2
> y = 97
> 97
> ~~~
> {: .output}
>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment