rwithik/song-downloader

Suggestion: Replace titleCase function with code below

cheofusi opened this issue · 0 comments

def titleCase(str):

'''
A function to convert the given song name to title case.
'''
words = []
for word in str.split():
    if word not in ['in', 'the', 'for', 'of', 'a', 'at', 'an', 'is', 'and']:
        words.append(word.capitalize())
    else:
        words.append(word)
return ' '.join(words)