Skip to content

Instantly share code, notes, and snippets.

@NotTheEconomist
Created October 2, 2015 01:28
Show Gist options
  • Save NotTheEconomist/ae027bd2585ac3422ec0 to your computer and use it in GitHub Desktop.
Save NotTheEconomist/ae027bd2585ac3422ec0 to your computer and use it in GitHub Desktop.
$ python -c "import tmp; print(tmp.spaceitout('I love dogs', 2))"
I l o v e d o g s
$ python -c "import tmp; print(tmp.spaceitout2('I love dogs', 2))"
I love dogs
$ cat expectedresult.txt
I l o v e d o g s
I l o v e d o g s
def spaceitout(source, count):
return (' '*count).join([letter for letter in source.replace(' ','')])
def spaceitout2(source, count):
return (' '*count).join(source.split())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment