1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Nikitich [7]
3 years ago
8

Write a program with a function that accepts a string as an argument and returns a copy of the string with the first character o

f each sentence capitalized. For instance, if the argument is "hello. my name is Joe. what is your name?" the function should return the string "Hello. My name is Joe. What is your name?". The program should let the user enter a string and then pass it to the function. The modified string should be displayed.
Computers and Technology
1 answer:
Alex Ar [27]3 years ago
7 0

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))

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

You might be interested in
1. Which of the following options will allow you to insert a quick table? (1 point) Insert ribbon > Shapes drop-down menu
emmasim [6.3K]
Quick tables are tables<span> that are stored in galleries as building blocks and can be reused and accessed at any time.</span>
The following option will allow you to insert a quick table:
Insert ribbon -> Table drop-down menu

Yous should click on the ribbon (tab) Insert and then from the Table drop-down in the Tables group, select Quick Tables.
5 0
3 years ago
Read 2 more answers
What is the status of this account?
nydimaria [60]

Answer:

the answer is A my mom is a accountant and she pretty much told me everything she knows... lol

Explanation:

plz give brainliest and rating hope this helps^_^

5 0
3 years ago
Read 2 more answers
When you select the data range for a pie chart, you should be sure to include the total cell on the worksheet?
Daniel [21]
This is not a question...
5 0
3 years ago
What would be the code of this in HTML ??
Alla [95]

Answer:r tHE RED LINE

Explanation:

Its not supost to be there

8 0
3 years ago
Using the following table as your starting point for each algorithm SJN Given the following information: Job: A B C D E Arrival
victus00 [196]

Answer:

Please check the attachment,

The average turnaround time is 4.8 and average waiting time is 1.

Please note: Exit time is same as completion time.

Explanation:

Please check the attachment.

7 0
3 years ago
Other questions:
  • What is the solubility of an empty soda can
    10·1 answer
  • Which characteristic would be best for a person seeking a career in the Telecommunications pathway?
    15·1 answer
  • Your supervisor has asked you to set up a RAID hard drive array in a tower system, which has a motherboard that uses the B360 ch
    10·1 answer
  • The smallest building block of a wireless lan is a ______.
    5·1 answer
  • Which tasks can be completed using the Chart Tools Design tab? Check all that apply.
    9·1 answer
  • You created the following dictionary relationships = {'Jimmy':'brother', 'Carol':'sister'}. You then executed the following code
    5·1 answer
  • Which option is the correct format of placing HTML tags while coding in HTML?
    13·2 answers
  • you are packing a mobile phone containing a lithium ion battery and you get a prompt on the screen to put a lithium ion label on
    13·1 answer
  • Which of the following is a key aspect of any IT position? installation of fiber optic cables
    14·2 answers
  • what is one benefit of placing voip gateways in geographically separated branch offices that have an existing wan connection?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!