80 Star 601 Fork 262

编程语言算法集 / Python

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
wave.py 437 Bytes
AI 代码解读
一键复制 编辑 原始数据 按行查看 历史
Margaret 提交于 2022-06-23 19:47 . Wave (#6061)
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()
Python
1
https://gitee.com/TheAlgorithms/Python.git
git@gitee.com:TheAlgorithms/Python.git
TheAlgorithms
Python
Python
master

搜索帮助