Skip to content

Commit cb6bab1

Browse files
authored
Merge branch 'master' into fix-gcd-edge-case
2 parents 7cae6ff + 8106aea commit cb6bab1

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

ciphers/caesar_cipher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def encrypt(input_string: str, key: int, alphabet: str | None = None) -> str:
4545
And our shift is ``2``
4646
4747
We can then encode the message, one letter at a time. ``H`` would become ``J``,
48-
since ``J`` is two letters away, and so on. If the shift is ever two large, or
48+
since ``J`` is two letters away, and so on. If the shift is ever too large, or
4949
our letter is at the end of the alphabet, we just start at the beginning
5050
(``Z`` would shift to ``a`` then ``b`` and so on).
5151

strings/reverse_words.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
def reverse_words(input_str: str) -> str:
2-
"""
3-
Reverses words in a given string
1+
def reverse_words(sentence: str) -> str:
2+
"""Reverse the order of words in a given string.
3+
4+
Extra whitespace between words is ignored.
5+
46
>>> reverse_words("I love Python")
57
'Python love I'
68
>>> reverse_words("I Love Python")
79
'Python Love I'
810
"""
9-
return " ".join(input_str.split()[::-1])
11+
return " ".join(sentence.split()[::-1])
1012

1113

1214
if __name__ == "__main__":

0 commit comments

Comments
 (0)