Skip to content

Instantly share code, notes, and snippets.

@alacret
Created November 12, 2019 00:37
Show Gist options
  • Save alacret/73f6ededfec35e13c6080756604c5419 to your computer and use it in GitHub Desktop.
Save alacret/73f6ededfec35e13c6080756604c5419 to your computer and use it in GitHub Desktop.
def generate_hashtag(s):
# Simple edge cases
if s == '':
return False
cache = []
for i in s.split(' '):
if i != '':
cache.append(i.capitalize())
result = ''.join(cache)
# result = ''.join([i.capitalize() for i in s.split('') if i != '' ])
if len(result) > 140:
return False
return "#" + result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment