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
castortr0y [4]
3 years ago
5

The function below takes a string argument sentence. Complete the function to return the second word of the sentence. You can as

sume that the words of the sentence are separated by whitespace. If the sentence contains less than two words, return None. If the last character of the word you are returning is a comma, semi-colon, period, exclamation point, or question mark, remove that last character.
Computers and Technology
1 answer:
enyata [817]3 years ago
3 0

Answer:

Following are the code to this question:

def string_argument(val): #Defining a method string_argument

   w= val.split() #Define variable that split value

   if len(w) < 2: # Define condition to check value length  

       return None #return value

   if w[1][-1] in ",;.!?": #Define condition to check special character  

       return w[1][:-1] #return second word

       return w[1] # return value

print(string_argument("good morning hello?")) #call method and print return value

print(string_argument("hii morning, DEV"))#call method and print return value

print(string_argument("how are you? MR"))#call method and print return value

print(string_argument("dev lambda. Who"))#call method and print return value

print(string_argument("thanks")) #call method and print return value

Output:

None

morning

None

lambda

None

Explanation:

In the given python program, a method "string_argument" is declared, that accepts a value val in its parameter, inside the method, another variable "w" is used, that splits the argument value. In the next line, two if conditional block is used which can be described as follows:

  • In the first block, it will check the length, it is not less then 2, if this condition is true it will return none.
  • In the second if the block it will check, that variable val holds any special character in its second word so, it will return the second word.
You might be interested in
If you want to change your system settings, what should you use
Vedmedyk [2.9K]

Answer:

you click on your profile, and you should see settings

Explanation:

4 0
3 years ago
Dan wants to check the layout of his web page content. What is the best way in which he can do this?
KatRina [158]
The answer is b I hope it helped
4 0
3 years ago
Read 2 more answers
___ allows you to select a consistently colored area without having to trace its outline.
Nezavi [6.7K]

Answer:

Magic Wand Tool

Explanation:

4 0
4 years ago
During class, your professor mentions an interesting article about Obama's networking in Iowa. From the Library homepage's list
jenyasd209 [6]

Answer:

True.

Explanation:

At the time of attending the class, the professor discusses an informative article regarding Iowa's networking with Obama. From those in the collection of Publications Indexes and Databases (References to an external site) of it's Libraries webpage, identify and scan the Sociological Analyses index using such terms: Political networking and Iowa to identify an article in Feb 2010.

Thus, topic words are helpful to identify related articles on the topic for students. Internet is the reference used for this article.

4 0
3 years ago
One way to save time and get to the colleges that you are most interested in at a college fair is to
son4ous [18]

Answer:

Identify the location of the college stand in advance.

Explanation:

One way to save time and get to the colleges that you are most interested in at a college fair is to find out in advance the information about the fair, the colleges that are participating and from that pick the more interesting ones and identify the location of their stands. Like that when you arrive to the fair you can go directly to them and find them easily which will save you a lot of time as you won't be walking around the whole place to find them.

8 0
3 years ago
Read 2 more answers
Other questions:
  • A security system uses sensors at every door and window which will set off an alarm if any one of them is opened. There is also
    13·1 answer
  • Why is Brainly always deleting either my answers or my questions? I am putting nothing inappropriate in them. Can someone answer
    7·2 answers
  • Bill needs to make a presentation in which he has to represent data in the form of a pyramid. Which feature or menu option of a
    10·2 answers
  • ____ is a programming language used to view and manipulate data that is stored in a database.
    6·1 answer
  • Which of the following experiences is considered a simulation?
    12·1 answer
  • When you first launch the internet, what page will open?
    9·1 answer
  • A technician is troubleshooting a printer connected to a computer via USB. The printer will print using the controls at the prin
    9·1 answer
  • PLEASE HELP!!!!!!!!!!!!!!!!!!!!
    13·1 answer
  • You want to change your cell phone plan and call the company to discuss options
    7·1 answer
  • Name:
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!