Skip to content

Commit 04bc8f0

Browse files
meg-1poyea
andauthored
Wave (#6061)
* Added censor function * Added censor code * Added comments to the code * modified censor function * added decrypt function * added cypher and decypher functions, deleted censor and decrypt functions * Deleted decrypt.py * Deleted censor.py * edited the crypt and decrypt files * Update cypher_txt.py * Remove the endline in cypher.py * Removed the print at the end of decypher.py * added 4 new algorithms * added tests to the four files * added type hints for the function variables * Deleted decode message * Deleted code message * Welford average algorithm * added average welford algorithm * is_narcissistic added * added a descriptive name * added max_sectors algorithm * added find_unique * added wave algorithm * deleting average_welford [ in the wrong pr ] * deleting is_narcissistic [ is in the wrong pr ] * deleting max_sectors [ is in the wrong pr ] * deleting find_unique [ is in the wrong pr ] * deleting censor [ is in the wrong pr ] * deleting decrypt [ is in the wrong pr ] * fixed wave.py fixed indentation and followed the bots reccomendations * fixed wave.py again * fixing wave.py for the third time. * fixing wave.py * merging strings/wave.py merging the suggestion Co-authored-by: John Law <[email protected]> Co-authored-by: John Law <[email protected]>
1 parent a80e5aa commit 04bc8f0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Diff for: strings/wave.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
def wave(txt: str) -> list:
2+
"""
3+
Returns a so called 'wave' of a given string
4+
>>> wave('cat')
5+
['Cat', 'cAt', 'caT']
6+
>>> wave('one')
7+
['One', 'oNe', 'onE']
8+
>>> wave('book')
9+
['Book', 'bOok', 'boOk', 'booK']
10+
"""
11+
12+
return [
13+
txt[:a] + txt[a].upper() + txt[a + 1 :]
14+
for a in range(len(txt))
15+
if txt[a].isalpha()
16+
]
17+
18+
19+
if __name__ == "__main__":
20+
__import__("doctest").testmod()

0 commit comments

Comments
 (0)