Your coworker was supposed to write a simple helper function to capitalize a string (that contains a single word) before they went on vacation.

Unfortunately, they have now left and the code they gave you doesn't work. Fix the helper function they wrote so that it works as intended (i.e. make the first character in the string "word" upper case).

Don't worry about numbers, special characters, or non-string types being passed to the function. The string lengths will be from 1 character up to 10 characters, but will never be empty.

Difficulty: introductory

Starter code:

def capitalize_word(word):
	

Solutions:
def capitalize_word(word):
    return word.capitalize()

    # .capitilize() for the first word in the string
    # .title() for each word in the string


def capitalize_word(word):
    return word.capitalize()

def capitalize_word(word):

    return "".join(char.capitalize() for char in word.split())

def capitalize_word(word):
    return str.capitalize(word)

def capitalize_word(word: str) -> str:
    """ Capitalize passed string. """
    return word.capitalize()

def capitalize_word(word):
    first = word[0].upper()
    remaining = word[1:].lower()
    text = first + remaining
    return text


def capitalize_word(word):
    a = word.lower()
    b = a.capitalize()
    return b

def capitalize_word(word):
    return "".join(word.capitalize())


'''delicious'''


def capitalize_word(word):
    return "".join(word[0].upper() + word[1:])

def capitalize_word(word):
    capLetter = "".join(char.capitalize() for char in word[0])
    capOthers = "".join(char.lower() for char in word[1:10])
    capWord = capLetter + capOthers
    return(str(capWord))

def capitalize_word(word):
    word=word.lower()
    word=word.title()
    return word

def capitalize_word(word):
    return word.title()

print(capitalize_word("word"))

def capitalize_word(word):
    return word.title()

def capitalize_word(word): 
    ans =  "".join(char.lower() for char in word)
    return ans.capitalize()

def capitalize_word(word):
  for char in word:
    len(word) > 1 and len(word) < 10
  return word.capitalize() 

print(capitalize_word("blea"))

def capitalize_word(w):
    for char in w[0]:
        return ''.join(char.title())+w[1:]

def capitalize_word(word):
    final = ""
    pos = 0
    while pos < len(word):
        if pos == 0:
            final += word[pos].upper()
        else:
            final += word[pos]
        pos += 1
    return final

def capitalize_word(word):
    for char in word:
        return word.title()

def capitalize_word(word):
    word_2 = ""
    for i in range(len(word)):
        if i == 0:
            word_2 += word[i].upper()
        else:
            word_2 += word[i]
    return word_2

def capitalize_word(word):
#     new_list=list(word)
#     first_letter = new_list.pop(0)
#     cap_letter = first_letter.capitalize()
#     new_list.insert(0,cap_letter)
#     print(cap_letter)
#     print(new_list)
#     return ("".join(new_list))
    return(word.title())

def capitalize_word(word):
    char = [char.upper() for char in word]
    return "".join(char[0] + word[1:])

def capitalize_word(word):
    newword = ""
    x=0
    for n in word:
        if x ==0:
            newword+=(word[0].upper())
            x+=1
        else:
            newword+=n
    
            
        
    
    return newword

def capitalize_word(*word):
    return "".join(char.title() for char in word)

def capitalize_word(word):
    if(len(word) >= 2):
        return word[0].upper() + word[1:]
    else:
        return word.upper()

def capitalize_word(word):
    str = ''
    lst = list()
    for i in word :
        lst.append(i)
        
    lst[0] = lst[0].upper()
    for i in lst :
        str += i
    return str


def capitalize_word(word):
    return word[0].upper() + ("" if len(word) == 1 else word[1:])

def capitalize_word(word):
    ls = list(word) # Turns string into a list of characters
    ls[0] = ls[0].upper() # Makes the first letter a capital
    return "".join(ls) # Joins the list elements back into a string.

def capitalize_word(word):
    firstLetter = word[0:1]
    restWord = word[1:]
    firstLetter = firstLetter.upper()
    return firstLetter + restWord

def capitalize_word(word):
    return word[0].upper() + word[1:len(word)].lower()

def capitalize_word(w):
    return w[0].upper() + w[1:].lower()

capitalize_word = lambda s: s.capitalize()

def capitalize_word(word):
    return "".join(char.upper() + word[1:] for char in word[:1])

def capitalize_word(word):
    return "".join(word.capitalize())
    #return "".join(char.upper() for char in word)


def capitalize_word(word):
    return capitalize(word)

def capitalize(word):
    s=''
    for i in range(len(word)):
        if (i==0):
            s+=word[i].upper()
        else:
            s+=word[i].lower()
    return s

def capitalize_word(word):
    x = word[0].upper()
    return x + word[1:]

def capitalize_word(word):
    words=word.capitalize()
    return words

def capitalize_word(word):
    return word[0].upper() + "".join(char for char in word[1::])

def capitalize_word(word):
    flit = list(word.lower())
    flit[0] = flit[0].upper()
    return "".join(flit)

def capitalize_word(word):
    letter = word
    return letter.title()

def capitalize_word(word):
    
    ans = (word).capitalize()
        
    return ans


def capitalize_word(word):
    for i in word: 
        if word[0].lower():
            return word[0].upper() + word[1:]

def capitalize_word(word):
    up = str(word)       #first indicating it is a string
    return up.capitalize()   #using the capitialize function which automatically capitlizes the first word


def capitalize_word(word):
    return str(word[0]).upper()+"".join(char for char in word[1:])
#return word.total()


def capitalize_word(word):
    #return "".join(char.upper() for char in word)
    
    word = word.lower()
    x = word.capitalize()
    return x

def capitalize_word(word=""):
    return f"{word.title()}"

def capitalize_word(word):
    char = 0
    while char < len(word):
        if char == 0:
            word2 = word[char].upper()
        else:
            word2 = word2 + word[char]
        char = char + 1
    return word2

def capitalize_word(word):
#1     return word.capitalize()
#2
    return word[0].upper() + word[1:].lower()

def capitalize_word(word):
    if len(word) == 1:
        return word.upper()
    return word[0].upper() + word[1:]

def capitalize_word(word):
    return word[0].upper()+word[1-len(word):] if len(word)!=1 else word[0].upper() 

def capitalize_word(word):
    return word.upper().title()

def capitalize_word(word):
#     return "".join(char.title() for char in word)
    return word.title()

def capitalize_word(word=''):
    return word.capitalize()

capitalize_word = lambda n : n.title()

def capitalize_word(word):
    return word.upper().capitalize()
   


import string

def capitalize_word(word):
    return f'{string.capwords(word)}'

import string

def capitalize_word(word):
    return string.capwords(word)

def capitalize_word(word):
    res = []
    res[:] = word
    print(res)
    newarry = []
    for i in range(0, len(res)):
        print((res[i]))
        if(res[i] == res[0]):
            newarry.append(res[0].upper())
        else:
            newarry.append(res[i])
    print(("".join(newarry)))
    answer = "".join(newarry)
    return answer


def capitalize_word(word):
    return (word.capitalize())

capitalize_word("hi")

def capitalize_word(word):
    #return word.title()
    return "".join(char.upper() if idx==0 else char for idx,char in enumerate(word))

def capitalize_word(word):
    init = word[0]
    rem = word[1: len(word)]
    return "".join([init.upper(),rem])

def capitalize_word(word):
    return ""+str(word.lower().capitalize())

def capitalize_word(word):
#     return "".join(char.capitalize() for char in word)
    return word.capitalize()

def capitalize_word(word):
    word=str(word)
    return word.capitalize()

def capitalize_word(word):
    if len(word) == 1:
        return "".join(char.upper() for char in word)
    else:
        return word[0].upper() + word[1:]

def capitalize_word(word):
    if word == word.lower():
        return word.capitalize()

def capitalize_word(word):
    return "".join([char for char in word.title()])

def capitalize_word(word):
    s = word[0].upper()
    word= s+word[1:]
    return word

def capitalize_word(word):
    arr=[]
    for i in range(len(word)):
        if i==0:
            arr.append(word[0].upper())
        else:
            arr.append(word[i])
    return ''.join(arr)

def capitalize_word(word):
    trueword = list(word)
    s = trueword[0]
    trueword[0] = s.upper() 
    return ''.join(trueword)


def capitalize_word(word):
    return str("".join(char.capitalize() for char in word)).title()

def capitalize_word(word):
        
        word = word.replace(word[0], word[0].upper(), 1)

        #result = word.replace(word[0], number)
        return word 
        
 


def capitalize_word(word):
    first_symbol=word[0].upper()
    return first_symbol+word[1:]

def capitalize_word(word):
    return ' '.join(word[:1].upper() + word[1:] for word in word.split(' ')) 

print(capitalize_word("hello"))

def capitalize_word(word):
    word = word.replace(word[0], word[0].upper(), 1)
    return word

def capitalize_word(word):
    "".join(char for char in word)
    return word.capitalize()

def capitalize_word(word):
    return "{}".format(word.capitalize())

def capitalize_word(word):
    all_lower=word.lower()
    capitalize=all_lower.capitalize()
    return capitalize

def capitalize_word(word):
    return "".join(word[char].upper() if char == 0 else word[char] for char in range(0, len(word)) )

def capitalize_word(word):
    new=word.lower()
    return new[0].upper()+new[1:]    
     


def capitalize_word(word):
    if len(word) < 0:
        return word[0].upper()
    char = word[0]
    word = word[1:]
    char = char.upper()
    return char + word

def capitalize_word(word):
    return f'{word.title()}'

def capitalize_word(word):
    a = word[0].upper()
    b=slice(1,len(word))
    y = word[b]
    return a+y

def capitalize_word(word):
    word = word.lower()
    word = word[0].upper() + word[1:]
    return word

def capitalize_word(word):
    print(word)
    return "".join(char.upper() if word.index(char) == 0 else char for char in word)

def capitalize_word(word):
    listWord = [word[0].upper()+word[1:]]
    return "".join(listWord)

def capitalize_word(word):
#     return "".join(word[0].upper() for char in word)
#     return word.capitalize()
    return word.title()

def capitalize_word(word):
    word = word
    return word.capitalize()

def capitalize_word(word):
    return word.capitalize()
print(capitalize_word('word'))