Skip to content

Instantly share code, notes, and snippets.

@vakhov
Created January 20, 2020 09:58
Show Gist options
  • Select an option

  • Save vakhov/51ee7e992b6e23949dbcd6677a11b1f1 to your computer and use it in GitHub Desktop.

Select an option

Save vakhov/51ee7e992b6e23949dbcd6677a11b1f1 to your computer and use it in GitHub Desktop.
def wave(word: str):
result = []
for i, let in enumerate(word):
if i == 0:
result.append(word.title())
elif i == len(word) - 1:
result.append(f"{word[:-1]}{word[-1].title()}")
else:
result.append(f"{word[:i]}{word[i].title()}{word[i + 1:]}")
return result
print(wave('hello'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment