Skip to content

Commit 3d71486

Browse files
meatball133BethanyG
authored andcommitted
Added back tilda
1 parent 2f190cd commit 3d71486

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

exercises/practice/rotational-cipher/.approaches/ascii-values/content.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ It uses numbers to represent 128 different entities including carriage returns,
2222
In ascii, all the lowercase English letters appear between 97 and 123.
2323
While the uppercase letters are in the range between 65 and 91.
2424

25-
```exercism/caution
25+
~~~~exercism/caution
2626
2727
This approach only supports the English alphabet.
2828
Non-English alphabets are not contiguous in their ascii number ranges, and are not consistently defined across platforms.
2929
For example, the Scandinavian letter: **å** has the extended ascii value of 132, but is used in combination with Latin characters that appear in the 65-91 and 97-123 ranges.
3030
This means that a shift for an extended ascii word containing **å** won't result in an accurate alphabet position for a Scandinavian language.
3131
32-
```
32+
~~~~
3333

3434
The approach starts with defining the function `rotate()`, with a variable `result` is assigned to an empty string.
3535
The elements of the text argument are then iterated over using a [`for loop`][for-loop].
@@ -40,7 +40,7 @@ Unicode's first 128 code points have the same numbers as their ascii counterpart
4040

4141
If the element is an uppercase letter, [`ord`][ord] is used to convert the letter to an integer.
4242
The integer is added to the numeric key and then 65 is subtracted from the total.
43-
Finally, the result is [modulo (`%`)][modulo] 26 (_to put the value within the 2_) and 65 is added back.
43+
Finally, the result is [modulo (%)][modulo] 26 (_to put the value within the 0-26 range_) and 65 is added back.
4444

4545
This is because we want to know which letter of the alphabet the number will become.
4646
And if the new number is over 26 we want to make sure that it "wraps around" to remain in the range of 0-26.

exercises/practice/rotational-cipher/.approaches/introduction.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ This approach is straightforward to understand.
1414
It uses the ascii value of the letters to rotate them within the message.
1515
The numbers 65-91 in the ascii range represent lowercase Latin letters, while 97-123 represent uppercase Latin letters.
1616

17-
```exercism/caution
17+
~~~~exercism/caution
1818
1919
This approach only supports the English alphabet.
2020
Non-English alphabets are not contiguous in their ascii number ranges, and are not consistently defined across platforms.
2121
For example, the Scandinavian letter: **å** has the extended ascii value of 132, but is used in combination with Latin characters that appear in the 65-91 and 97-123 ranges.
2222
This means that a shift for an extended ascii word containing **å** won't result in an accurate alphabet position for a Scandinavian language.
2323
24-
```
24+
~~~~
2525

2626
```python
2727
def rotate(text, key):
@@ -73,9 +73,9 @@ For more information, check the [Alphabet approach][approach-alphabet].
7373
This approach uses the [`str.translate`][str-translate] method to create a mapping from input to shifted string instead of using the index of an alphabet string to calculate the shift.
7474
The benefit of this approach is that it has no visible loop, making the code more concise.
7575

76-
```exercism/note
76+
~~~~exercism/note
7777
`str.translate` **still loops over the `string`** even if it is not visibly doing so.
78-
```
78+
~~~~
7979

8080
```python
8181
AlPHABET = "abcdefghijklmnopqrstuvwxyz
@@ -93,10 +93,10 @@ This approach uses a recursive function.
9393
A recursive function is a function that calls itself.
9494
This approach can be more concise than other approaches, and may also be more readable for some audiences.
9595

96-
```exercism/caution
96+
~~~~exercism/caution
9797
Python does not have any tail-call optimization and has a default [recursion limit][recursion-limit] of 1000 calls on the stack.
9898
Calculate your base case carefully to avoid errors.
99-
```
99+
~~~~
100100

101101
```python
102102
AlPHABET = "abcdefghijklmnopqrstuvwxyz"

exercises/practice/rotational-cipher/.approaches/recursion/content.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ Then the `rotate` function can execute the same code again with new values.
2828
We can build a long chain or "stack" of `<letter> + rotate(rest)` calls until the `rest` variable is exhausted and the code adds `""`.
2929
That translates to something like this: `<letter> + <letter> + <letter> + <letter> + ""`.
3030

31-
```exercism/note
31+
~~~~exercism/note
3232
By default, we can't have a function call itself more than 1000 times.
3333
Code that exceeds this recursion limit will throw a RecursionError.
3434
While it is possible to adjust the recursion limit, doing so risks crashing Python and may also crash your system.
3535
Casually raising the recursion limit is not recommended.
36-
```
36+
~~~~
3737

3838
[clojure]: https://exercism.org/tracks/clojure
3939
[elixir]: https://exercism.org/tracks/elixir

0 commit comments

Comments
 (0)