Capitalize!

Sort by

recency

|

2915 Discussions

|

  • + 0 comments

    def solve(s): result = ' '.join(word.capitalize() for word in s.split(' ')) return result

  • + 0 comments
    def solve(s):
        s=s.split(" ")
        j=[]``
        for i in s:
            if i.isalpha():
                j.append(i.title())
            else:
                j.append(i)
        return " ".join(i for i in j)
            
        
    
  • + 0 comments

    Beginner friendly solution:

    def solve(s: str):
        words=s.split(" ")   # giving the split an explicit separator of " ", so that it includes the empty spaces
        
        for i in range(len(words)):
            words[i] = words[i].capitalize()
                
        return ' '.join(words)
    
  • + 0 comments

    def solve(s): n_str = "" s = s.split(" ") for words in s: n_str += words.capitalize() n_str += " " return n_str

  • + 0 comments

    def solve(s): return ' '.join(word.capitalize() for word in s.split(' '))