Answer:
def capitalize_first(st):
capitilized_list = []
splitted_st = st.split(". ")
for x in splitted_st:
capitilized_list.append(x[0].capitalize() + x[1:])
capitilized_st = ". ".join(capitilized_list)
return capitilized_st
s = input("Enter a string: ")
print(capitalize_first(s))
Step-by-step explanation:
Create a function called capitalize_first that takes one parameter, st
Create an empty list that will hold the capitalized strings
Split the given string using split function and put them in the splitted_st
Create a for loop that iterates through splitted_st. For each string in splitted_st, capitalize their first character and put them in the capitalized_list.
When the loop is done, join the strings in the capitalized_list using join function and set the joined string to capitilized_st
Return the capitilized_st
Ask the user for the string
Call the function with entered input and print the result