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
A que generacion pertenecen los gadgets?
alukav5142 [94]

Answer:

English please

Explanation:

8 0
2 years ago
Given a list of integers. find the size of the list
dlinn [17]

The size of a list of integers can be found using python as follows;

size = len(list1)

<h3>How to find the size of a list using python?</h3>

The size of a list can be found using the len() function in python.

According to the question, the list is an integer.

Therefore, let's use an example below:

list1 = [1, 2, 1, 3, 6, 7, 8, 9, 4, 7, 8, 6, 4]

size = len(list1)

print(size)

Therefore,  the size of a list of integers can be found using the len() function in python.

learn more on python here: brainly.com/question/14989942

#SPJ1

6 0
2 years ago
What are 3 data Gathering method that you find effective in creating interactive design for product interface and justify your a
ozzi

Answer:

In other words, you conducted the four fundamental activities that make up the interaction design process – establishing requirements, designing alternatives, prototyping designs, and evaluating prototypes.

Explanation:

5 0
3 years ago
A company sells 12-month subscriptions to popular magazines. During the month of may, the company sells $10,000 in magazines, wh
Korvikt [17]

Good is for aware consumers who value quality of life, fashion, and the environment. The areas of home, fashion, gardening, crafts, travel, health, and beauty are all covered in each issue of Good.

<h3>What journal entry to record the sales not yet earned?</h3>

When a business sells any merchandise to a third party on credit, an entry called a sales credit journal entry is made in the company's sales journal.

There is usually a selection of delectable dishes as well as professional advice on relationships, wellness, and nutrition.

Therefore,  In this instance, the sales account is credited in proportion to the debit to the debtor's account or account receivable account.

Learn more about journal entry here:

brainly.com/question/20421012

#SPJ1

4 0
1 year ago
The process by which the kernel temporarily moves data from memory to a storage device is known as what?
Alona [7]

Answer: Swapping

Explanation:

Swapping is referred to as the process by which the kernel temporarily moves data from memory to a storage device.

Swapping is simply a memory management scheme whereby the process can be swapped temporarily from the main memory to the secondary memory in order for the main memory to be available for other processes. Swapping is used for memory utilization.

8 0
3 years ago
Other questions:
  • This provides an easy method for workers to use their computers.
    11·2 answers
  • The value 5 is stored in a signed (2's complement) integer. The bits are shifted 4 places to the right. What is the resultant va
    12·1 answer
  • 1. Describe your Microsoft word skills that need to be improved upon the most. 2. Explain the Microsoft word skills you are most
    12·1 answer
  • Which of the following statements describes a good reason to use lossless audio compression?
    6·1 answer
  • The use of logistics software at DCS (7 points)
    5·1 answer
  • When was kale discovered?
    9·1 answer
  • Which type of loan is based on financial need
    6·1 answer
  • Write: In a five-paragraph essay that is two to three pages in length, address the
    13·1 answer
  • You are developing a Website that is going to be viewed extensively on smartphones and tablets. Which of the following should yo
    7·1 answer
  • The microprogram counter (MPC) contains the address of the next microcode statement for the Mic1 emulator to execute. The MPC va
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!