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
Is wireless or wired network faster??
bogdanovich [222]

Answer:

Wired

Explanation:

3 0
3 years ago
Read 2 more answers
FREEFREEFREEFREEFREEFREE
Brrunno [24]

Answer:

niceeee :0

Explanation:

5 0
3 years ago
Read 2 more answers
Which of the following is not hardware? Question 7 options: A) Wireless network router B) Printer C) Virus Scanner D) Flat-panel
jok3333 [9.3K]

the answer is virus scanner which is not hardware but software because if you didn't know hardware is stuff like a monitor a mouse a battery a case that's all stuff you can generally touch even the hardware inside the computer you can touch where as virus scanner you can not touch because its software again my point being its software NOT hardware

8 0
3 years ago
Sharing a workbook helps to complete on time. Multiple people accessing the workbook help to build
BlackZzzverrR [31]
Collaboration skills
7 0
3 years ago
Some of the ways we can resolve IPv4 address shortage
tekilochka [14]

Answer:

NAT

Proxy

IPv6

Explanation:

Network Address Translation (NAT) allows a local area network (LAN) to connect to the internet using only one external IP address. The LAN addresses (typically 192.168.x.x) can be used over and over again.

A proxy is a computer that makes requests to the internet on behalf of the computers on a LAN. It is a more restricted flavour compared to the NAT, but the effect is the same.

IPv6 is a new addressing scheme that will use a 48 bits address space rather than a 32 bits address space of IPv6, and that would provide plenty of addresses.

7 0
3 years ago
Other questions:
  • How does the use of modules provide flexibility in a structured programming design?
    14·2 answers
  • To specify grouping and sorting for a report, click the ____ button on the design tab in layout view.
    14·1 answer
  • Write a program that calculates the cost of a phone call. The user enters a positive integer that
    11·1 answer
  • On a hard disk each track is divided into invisible wedge-shaped sections called _______
    15·1 answer
  • 15. Write a program in python to read three numbers in three variables and swap first two variables with the sums of
    8·1 answer
  • Consider a binary-search method in an array that reports whether an object is in the array. The documentation indicates that the
    11·1 answer
  • What does Pentium means?:/
    7·2 answers
  • GPS data can be used to track the rate and direction of plate movement. If a GPS unit measures a latitude velocity of 28.2 mm/yr
    8·1 answer
  • 5.During a recent network attack, a hacker used rainbow tables to guess network passwords. Which type of attack occurred
    9·1 answer
  • Use the drop-down tool to select the word or phrase that completes each sentence.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!