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
irinina [24]
2 years ago
11

2. Write a program with a function that accepts a string as an argument and returns a copy of the string with the first characte

r of 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:
Oduvanchick [21]2 years ago
4 0

Answer:

Following are the code to this question:

def capital(val):#defining a method that takes string value as parameter

   x=True#defining boolean variable

   r=''#defining string variable  

   for i in val:#defining loop to convert the first character into upper case

       if i.isalpha() and x:#defining condition to check input value is string

           r=r+i.upper()#change value into uppercase and hold value in r variable

           x=False#assign value false in boolean variable

       elif i=='.' or i=='?' or i=='!':#check symbols

           r=r+i#add value in r variable

           x=True#assign value True in boolean variable

       else:

           r=r+i#add all value in r variable

   return r#return r variable value

val=input()#input value in val variable

print(capital(val))#called the function which print the return value

Output:

please find the attachment.

Explanation:

  • In the above python program, a method "capital" is declared, which accepts a "val" a string value in its parameter, and inside the method one boolean "x" and one string "r" variable is used, in which r stores return value.
  • In the next step, for loop is declared, inside the loop, the conditional statement is used, in if the block it checks string value and converts the first character into upper case and assigns value false in the boolean variable.  
  • In the next step, elif block is defined that adds value in r variable and at the last, it will return function value, at the last step "val" variable is declared that input value from the user and pass into the method and print its return value.

You might be interested in
Namespaces are guaranteed to be unique.<br><br> True<br><br> False
kupik [55]

Answer:

True

Explanation:

Some collection of classes or library functions grouped as one name space. A class which belongs to one namespace is different from the class which belongs to another namespace. we can identify a class uniquely with it's namespace .

for ex:

in c#.net

using system;

System.IO;

here System is the namespace which contains class IO

namespace contains any number of classes . In one namespace we can't define two classes with same Name. We can define two classes with same name in different namespaces

5 0
3 years ago
What kind of operating system is MS-DOS?
ELEN [110]

MS-DOS is a command-line operating system.

Therefore, the best answer is Command-line.

8 0
3 years ago
Read 2 more answers
When installing the latest version of Internet Explorer, a dialogue box pops up with a box checked telling you that Bing will be
meriva

Answer:

B) opt-out identify

Explanation:

To opt-out means refusing to or avoiding to accept unsolicited refers to  products or service information. In this caseyou are refusing to accept Bing as your default search provider

8 0
2 years ago
A system forensics specialist has three basic tasks related to handling evidence: find evidence, preserve evidence, and ________
dmitriy555 [2]

Answer:

It would be Store

Explanation:

hope this helps if not sorry :(

3 0
2 years ago
Which act requires enterprises to guard protected health information and implement policies and procedures to safeguard it?
bogdanovich [222]

Answer:

D. HIPAA (Health Insurance Portability and Accountability Act)

Explanation:

HIPAA which stands for Health Insurance Portability and Accountability Act, is an act designed by the US government in 1996 to guard patients' confidential health information and also implement policies and procedures to safeguard it. The act contains the required information and instruction for handling patients' medical health information. The law however gives patients (or their representatives) the right to access these information which as a matter of fact must be made available within 30 days from the day of request.

PS: Not sure why the option D in the question contains ' FTF '. I have taken it to be a typo because without it, the option is in itself complete.

7 0
3 years ago
Other questions:
  • 14. Which commercial RDBMS product was the first to hit the market and is the biggest?
    15·1 answer
  • To help determine which technology to use, Raul creates a table to help him compare the pros and cons of his choices. What part
    15·1 answer
  • Garry is a record executive who is building a data table to include in a presentation about one of his artists. The table is mea
    15·1 answer
  • Which one of the following is not possible to view in the debug logs?
    8·1 answer
  • Your task is to write a C program that measures the latencies of various system calls. In particular, you want to know 1) the co
    5·1 answer
  • What is the difference between KE an PE
    8·1 answer
  • 9. "मेरे तो गिरधर गोपाल, दूसरो ना कोई
    5·1 answer
  • How do you open an application on the macOS?
    11·2 answers
  • Blockchain is often associated with Bitcoin and the financial services industry. However, it is applicable to almost every indus
    13·1 answer
  • Pls need this asap
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!