mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-30 16:31:08 +00:00
04bc8f01dd
* 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 <johnlaw.po@gmail.com> Co-authored-by: John Law <johnlaw.po@gmail.com>
21 lines
437 B
Python
21 lines
437 B
Python
def wave(txt: str) -> list:
|
|
"""
|
|
Returns a so called 'wave' of a given string
|
|
>>> wave('cat')
|
|
['Cat', 'cAt', 'caT']
|
|
>>> wave('one')
|
|
['One', 'oNe', 'onE']
|
|
>>> wave('book')
|
|
['Book', 'bOok', 'boOk', 'booK']
|
|
"""
|
|
|
|
return [
|
|
txt[:a] + txt[a].upper() + txt[a + 1 :]
|
|
for a in range(len(txt))
|
|
if txt[a].isalpha()
|
|
]
|
|
|
|
|
|
if __name__ == "__main__":
|
|
__import__("doctest").testmod()
|