* 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>
This commit is contained in:
Margaret 2022-06-23 19:47:29 +03:00 committed by GitHub
parent a80e5aadf3
commit 04bc8f01dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

20
strings/wave.py Normal file
View File

@ -0,0 +1,20 @@
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()