Skip to content

Instantly share code, notes, and snippets.

@cevaris
Created January 4, 2021 00:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cevaris/b491d82b8da318a92fa2e2ce38769d6b to your computer and use it in GitHub Desktop.
Save cevaris/b491d82b8da318a92fa2e2ce38769d6b to your computer and use it in GitHub Desktop.
snake_to_hyphen_case.py
input = 'this_is_a_test_string'
output = ''
for i in range(0, len(input)):
char = input[i]
if char == '_':
output += '-'
else:
output += char
print(input)
print(output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment