GitHub

Original file line numberDiff line numberDiff line change

@@ -524,7 +524,10 @@ If you can, add a legend, to help distinguish between the three time series.

524524

Hints:

525525
526526

* If you call the `plot()` function multiple times before calling `show()`, all of the lines you produce will end up on the same figure.

527-

* For the legend, noted that the expression `'foo' + str(42)` evaluates to `'foo42'`.

527+

* For the legend, noted that if `var = 42`, the expression `f'foo{var}'` evaluates to `'foo42'`.

528+
529+

Note: `f'foo{var}'` is an example of [f-String](https://docs.python.org/3/tutorial/inputoutput.html#tut-f-strings), which allows you to use `{}` to contain an expression. The contained expression will be evaluated, and the result will be placed into the string.

530+
528531

```

529532
530533

```{exercise-end}

@@ -550,11 +553,6 @@ plt.legend()

550553

plt.show()

551554

```

552555
553-

Note: `f'$\\alpha = {α}$'` in the solution is an application of [f-String](https://docs.python.org/3/tutorial/inputoutput.html#tut-f-strings), which allows you to use `{}` to contain an expression.

554-
555-

The contained expression will be evaluated, and the result will be placed into the string.

556-
557-
558556

```{solution-end}

559557

```

560558

Read the original on github.com ↗