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.
- Prepare
- Python
- Strings
- Capitalize!
- Discussions
Capitalize!
Capitalize!
Sort by
recency
|
2720 Discussions
|
Please Login in order to post a comment
def solve(s): word = s.split(' ') string = "" for name in word: string = string + name.capitalize()+" "
def solve(s): cap = s.title() return cap
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
!/bin/python3
import math import os import random import re import sys
Complete the solve function below.
def solve(s): for i in s.split(): s=s.replace(i,i.capitalize()) return s
if name == 'main': fptr = open(os.environ['OUTPUT_PATH'], 'w')