curriculum/challenges/english/blocks/daily-coding-challenges-python/691b559495c5cb5a37b9b486.md
Given a string title, return a new string formatted in title case using the following rules:
title_case("hello world") should return "Hello World".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(title_case("hello world"), "Hello World")`)
}})
title_case("the quick brown fox") should return "The Quick Brown Fox".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(title_case("the quick brown fox"), "The Quick Brown Fox")`)
}})
title_case("JAVASCRIPT AND PYTHON") should return "Javascript And Python".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(title_case("JAVASCRIPT AND PYTHON"), "Javascript And Python")`)
}})
title_case("AvOcAdO tOAst fOr brEAkfAst") should return "Avocado Toast For Breakfast".
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(title_case("AvOcAdO tOAst fOr brEAkfAst"), "Avocado Toast For Breakfast")`)
}})
def title_case(title):
return title
def title_case(title):
return " ".join(
w[:1].upper() + w[1:].lower()
for w in title.split(" ")
)