I got most of the code down but I am having issues getting the string to space back out after making the first letter of each word uppercase
here's what I have so far:
message = input('Write a short message.')
new_message = message.split()
glue = ""
for item in new_message:
glue += item[0].upper() + item[1:]
print(glue)
try with:
message.capitalize()
If you want to capitalize each word you can try capitalize() and the code will look like this:
message = input('Write a short message.')
new_message = message.split()
cap_message = [x.capitalize() for x in new_message]
print(cap_message)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.