Skip to content

Commit 8ca8a89

Browse files
committed
added new line at the end of the file
2 parents 18c8286 + 145ffe0 commit 8ca8a89

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

sorts/cocktail_shaker_sort.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ def cocktail_shaker_sort(unsorted: list) -> list:
4242
doctest.testmod()
4343
user_input = input("Enter numbers separated by a comma:\n").strip()
4444
unsorted = [int(item) for item in user_input.split(",")]
45-
print(f"{cocktail_shaker_sort(unsorted)= }")
45+
print(f"{cocktail_shaker_sort(unsorted) = }")

strings/naive_string_search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ def naive_pattern_search(s: str, pattern: str) -> list:
3939

4040
if __name__ == "__main__":
4141
assert naive_pattern_search("ABCDEFG", "DE") == [3]
42-
print(f"{naive_pattern_search('ABAAABCDBBABCDDEBCABC', 'ABC')=}")
42+
print(f"{naive_pattern_search('ABAAABCDBBABCDDEBCABC', 'ABC') = }")

strings/swap_case.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'''
1+
"""
22
This algorithm helps you to swap cases.
33
44
User will give input and then program will perform swap cases.
@@ -10,12 +10,11 @@
1010
2)>>> Please input sentence: github.com/mayur200
1111
GITHUB.COM/MAYUR200
1212
13-
'''
13+
"""
1414
import re
15-
'''
16-
This re.compile() function saves the pattern from 'a' to 'z' and 'A' to 'Z' into 'regexp' variable
17-
'''
18-
regexp = re.compile('[^a-zA-Z]+')
15+
16+
# This re.compile() function saves the pattern from 'a' to 'z' and 'A' to 'Z' into 'regexp' variable
17+
regexp = re.compile("[^a-zA-Z]+")
1918

2019

2120
def swap_case(sentence):
@@ -24,21 +23,20 @@ def swap_case(sentence):
2423
>>> swap_case('Algorithm.Python@89')
2524
aLGORITHM.pYTHON@89
2625
"""
27-
newstring = ''
26+
new_string = ""
2827
for char in sentence:
2928
if char.isupper() == True:
30-
newstring += char.lower()
29+
new_string += char.lower()
3130
if char.islower() == True:
32-
newstring += char.upper()
31+
new_string += char.upper()
3332
if regexp.search(char):
34-
newstring += char
33+
new_string += char
3534

36-
return newstring
35+
return new_string
3736

3837

3938
if __name__ == '__main__':
4039
s = input("Please input sentence:")
4140
result = swap_case(s)
4241
print(result)
4342

44-

0 commit comments

Comments
 (0)