Skip to content

Commit

Permalink
Use tildas (#3468)
Browse files Browse the repository at this point in the history
Replaces backticks with tildas for the admonitions.
  • Loading branch information
meatball133 authored Jul 16, 2023
1 parent aa3e379 commit 6dcb660
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions concepts/unpacking-and-multiple-assignment/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ This is often used in multiple assignment to group all "leftover" elements that
It is common in Python to also exploit this unpacking/packing behavior when using or defining functions that take an arbitrary number of positional or keyword arguments.
You will often see these "special" parameters defined as `def some_function(*args, **kwargs)` and the "special" arguments used as `some_function(*some_tuple, **some_dict)`.

```exercism/caution
~~~~exercism/caution
`*<variable_name>` and `**<variable_name>` should not be confused with `*` and `**`. While `*` and `**` are used for multiplication and exponentiation respectively, `*<variable_name>` and `**<variable_name>` are used as packing and unpacking operators.
```
~~~~

## Multiple assignment

Expand Down Expand Up @@ -69,9 +69,9 @@ Since `tuples` are immutable, you can't swap elements in a `tuple`.

## Unpacking

```exercism/note
~~~~exercism/note
The examples below use `lists` but the same concepts apply to `tuples`.
```
~~~~

In Python, it is possible to [unpack the elements of `list`/`tuple`/`dictionary`][unpacking] into distinct variables.
Since values appear within `lists`/`tuples` in a specific order, they are unpacked into variables in the same order:
Expand Down Expand Up @@ -305,13 +305,13 @@ c = 3
You can also write parameters before `*args` to allow for specific positional arguments.
Individual keyword arguments then have to appear before `**kwargs`.

```exercism/caution
~~~~exercism/caution
[Arguments have to be structured](https://www.python-engineer.com/courses/advancedpython/18-function-arguments/) like this:
`def my_function(<positional_args>, *args, <key-word_args>, **kwargs)`
If you don't follow this order then you will get an error.
```
~~~~

```python
>>> def my_function(a, b, *args):
Expand Down
4 changes: 2 additions & 2 deletions concepts/unpacking-and-multiple-assignment/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ This is often used in multiple assignment to group all "leftover" elements that
It is common in Python to also exploit this unpacking/packing behavior when using or defining functions that take an arbitrary number of positional or keyword arguments.
You will often see these "special" parameters defined as `def some_function(*args, **kwargs)` and the "special" arguments used as `some_function(*some_tuple, **some_dict)`.

```exercism/caution
~~~~exercism/caution
`*<variable_name>` and `**<variable_name>` should not be confused with `*` and `**`. While `*` and `**` are used for multiplication and exponentiation respectively, `*<variable_name>` and `**<variable_name>` are used as packing and unpacking operators.
```
~~~~

[multiple assignment]: https://www.geeksforgeeks.org/assigning-multiple-variables-in-one-line-in-python/
8 changes: 4 additions & 4 deletions exercises/concept/locomotive-engineer/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ Your friend Linus is a Locomotive Engineer who drives cargo trains between citie
Although they are amazing at handling trains, they are not amazing at handling logistics or computers.
They would like to enlist your programming help organizing train details and correcting mistakes in route data.

```exercism/note
~~~~exercism/note
This exercise could easily be solved using slicing, indexing, and various `dict` methods.
However, we would like you to practice packing, unpacking, and multiple assignment in solving each of the tasks below.
```
~~~~

## 1. Create a list of all wagons

Expand Down Expand Up @@ -75,9 +75,9 @@ The first `dict` contains the origin and destination cities the train route runs
The second `dict` contains other routing details such as train speed, length, or temperature.
The function should return a consolidated `dict` with all routing information.

```exercism/note
~~~~exercism/note
The second `dict` can contain different/more properties than the ones shown in the example.
```
~~~~

```python
>>> extend_route_information({"from": "Berlin", "to": "Hamburg"}, {"length": "100", "speed": "50"})
Expand Down
12 changes: 6 additions & 6 deletions exercises/concept/locomotive-engineer/.docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ Unpacked values can then be assigned to variables within the same statement, whi

The special operators `*` and `**` are often used in unpacking contexts and with multiple assignment.

```exercism/caution
~~~~exercism/caution
`*<variable_name>` and `**<variable_name>` should not be confused with `*` and `**`. While `*` and `**` are used for multiplication and exponentiation respectively, `*<variable_name>` and `**<variable_name>` are used as packing and unpacking operators.
```
~~~~

## Multiple assignment

Expand Down Expand Up @@ -57,9 +57,9 @@ Since `tuples` are immutable, you can't swap elements in a `tuple`.

## Unpacking

```exercism/note
~~~~exercism/note
The examples below use `lists` but the same concepts apply to `tuples`.
```
~~~~

In Python, it is possible to [unpack the elements of `list`/`tuple`/`dictionary`][unpacking] into distinct variables.
Since values appear within `lists`/`tuples` in a specific order, they are unpacked into variables in the same order:
Expand Down Expand Up @@ -293,13 +293,13 @@ c = 3
You can also write parameters before `*args` to allow for specific positional arguments.
Individual keyword arguments then have to appear before `**kwargs`.

```exercism/caution
~~~~exercism/caution
[Arguments have to be structured](https://www.python-engineer.com/courses/advancedpython/18-function-arguments/) like this:
`def my_function(<positional_args>, *args, <key-word_args>, **kwargs)`
If you don't follow this order then you will get an error.
```
~~~~

```python
>>> def my_function(a, b, *args):
Expand Down

0 comments on commit 6dcb660

Please sign in to comment.