Friday, April 17, 2020

capitalize each word in python

# Complete the solve function below.
def solve(s):
    if len(s)>0 and len(s)<1000:
        capital_words = s.title()       
        return capital_words

if __name__ == '__main__':
    fptr = open(os.environ['OUTPUT_PATH'], 'w')

    s = input()

    result = solve(s)

    fptr.write(result + '\n')

    fptr.close()

output:
hello world
Hello World

No comments:

Post a Comment

python class topic video