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
Drag the system component on the left to the device or program that fits with the system component.
Strike441 [17]

Answer:

A. Back up software - Utility software

B. Printer - Device drivers

C. Camera - Firmware

D. Television - Firmware

E. Games console - Firmware

F. Antivirus software - Utility software

G. Disk Cleaner - Utility software

H. Video Card - Device drivers

Explanation:

Computer system components are the physical or hardware and software parts of the device. It is a combination of system software like utility software, device drivers and firmware, application software, and the hardware components and kernel.

4 0
3 years ago
You use webshot to create desktop slide shows for your personal screen saver. Your boss asks you to display your screen so that
FrozenT [24]
I believe _B_ but check the national copyright law.
8 0
3 years ago
Read 2 more answers
Problemele 2 si 3 va rog
Monica [59]

Answer:

idek

Explanation:

5 0
3 years ago
PrintErrorDescription is a function that accepts one int parameter and returns no value. Write a statement that calls the functi
dmitriy555 [2]

Answer:

  1.    public static void main(String[] args) {
  2.        printErrorDescription(14);
  3.    }
  4.    public static void printErrorDescription(int value){
  5.        //some codes
  6.    }

Explanation:

Given a function <em>printErrorDescription() </em>with one parameter (Line 5 - 7). To call the function, we can write the function name and place the value of 14 within the parenthesis (Line 2). The value of 14 is a function argument. The value of 14 will be processed within the function to meet some purposes.    

3 0
4 years ago
If\s*.*[&gt;&lt;]=.*\s*:<br> what does this mean
trasher [3.6K]

You know that means if you use c++

you need to put something in this

#include<iostream>

using namespace std;

int what_ you_ want;

int main ()

{

cout<<"WHAT DO U WANT"; cin>>what_you_want;

if (what_you_want<1000)

and then use {, else, } return 0;

but it is good for c++


5 0
3 years ago
Other questions:
  • A suspension system that allows one wheel to move up and down with minimal effect on the opposite wheel is called what? A. Stabi
    14·2 answers
  • Write a function max_magnitude() with two integer input parameters that returns the largest magnitude value. Use the function in
    15·1 answer
  • Need Help ASAP!
    14·2 answers
  • Which statement is true about customizing presentation programs?
    6·1 answer
  • Tara and Zach are leading a systems development project and they want the investigation phase to go smoothly and quickly. They d
    5·1 answer
  • A haiku is a three-line poem in which the first line contains five syllables, the second line contains seven syllables, and the
    12·1 answer
  • Which of the following companies develop, own, and provide travel products for people?
    8·1 answer
  • Consider the following definitions:public boolean someMethod (int[] list, int value){ int counter; boolean flag = false; for (co
    10·1 answer
  • If a fuse block or holder has tree fuses, it may be termed a...
    7·1 answer
  • Why is experience in their own factory setting
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!