We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
hi. i know that i made things complicated but can you tell me why i fail some of the test cases (4/6), with this code?
import string
alphabet_list = list(string.ascii_lowercase)
def solve(s):
list1 = s.split()
answer = []
for each in list1:
if each[0] in alphabet_list:
answer.append(each.title())
else:
answer.append(each)
final = " ".join(answer)
return final
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Capitalize!
You are viewing a single comment's thread. Return to all comments →
hi. i know that i made things complicated but can you tell me why i fail some of the test cases (4/6), with this code?
import string alphabet_list = list(string.ascii_lowercase) def solve(s): list1 = s.split() answer = [] for each in list1: if each[0] in alphabet_list: answer.append(each.title()) else: answer.append(each) final = " ".join(answer) return final