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]
2 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]2 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
Remembering on which continent 5 different countries are located
Illusion [34]

Answer:

South america.

Explanation:

8 0
3 years ago
An ______ search is when the buyer looks for information beyond personal knowledge to help make the buying decision, such as che
victus00 [196]

Answer: External

Explanation: External search could be explained as the additional information gathered beyond an individual's personal knowledge or experience in a bit to influence the individual's decision on a particular product or topic. This additional information could include; information sought from friends and families, online or internet research on relevant site, blogs or publications.

Therefore, a buyer who asks a friend, checking the internet or visiting a showroom or make other enquiries beyond his personal knowledge in other to make buying decision is making an external search.

6 0
2 years ago
The ________ is the biggest power consumer on a mobile computing device.
AleksandrR [38]

The part of a computing device that is the biggest power consumer is;

Central Processing Unit

<h3>Central Processing Unit</h3>

The part of a computing device that cosnumes the most power is called the Central Processing Unit (CPU). This is due to the following reasons;

  • The CPU consists of motherboard and battery that draws power from the socket.

  • The Mother board is equipped with logic gates that are used to implement logic in the computer.

  • The Logic gates are voltage signals that signify the binary information that are fed into the system.

Read more about Central Processing Unit (CPU) at; brainly.com/question/4558917

5 0
2 years ago
Write a Python program which asks a user for a word and performs letters manipulation. If the word is empty, the program should
never [62]

Answer:

The program is as follows:

word = input("Enter a word: ")

if word:

   if len(word) <= 4:

       word = word[::-1]

   else:

       word = word[0]+word[1]+word[-2]+word[-1]

   print(word)

else:

   print('empty!')

Explanation:

This gets input for word from the user

word = input("Enter a word: ")

If input is not empty

if word:

This checks if the length is less than or equal to 4 characters

   if len(word) <= 4:

If yes, this reverses the word

       word = word[::-1]

If otherwise,

   else:

This gets the first, second, second to last two characters

       word = word[0]+word[1]+word[-2]+word[-1]

Print the new string

   print(word)

Print empty, if input is empty

<em>else: </em>

<em>    print('empty!')</em>

8 0
3 years ago
In symmetric encryption the same key is used to encrypt and decrypt a message. in asymmetric encryption different keys are used
Brrunno [24]

A useful advantage of Asymmetric encryption over symmetric encryption is that there is no secret channel necessary for the exchange of the public key, unlike in the symmetric encryption which requires a secret channel to send the secret key.  

Another advantage of Asymmetric encryption is that is has increased security. Asymmetric uses two different keys (Public and private) for both encryption and decryption of data while symmetric uses one.

5 0
3 years ago
Read 2 more answers
Other questions:
  • Microsoft Xbox operating system provides Xbox programmers with a set of common standards to use to access controllers, the Kinec
    6·1 answer
  • Which term is used to describe a password-protected, encrypted data file that verifies the identity of the sender of a message?
    8·1 answer
  • Help!!!!!!!!!!!!!!!!!!!
    12·1 answer
  • What's the best strategy for avoiding ATM fe
    14·1 answer
  • Pls help me<br> first one to answer correctly gets brainly points
    6·2 answers
  • When machining rotors, what is the reason for setting the indexing collars to zero?
    9·1 answer
  • How does natural gas move through pipelines from the well head to the end user thousands of miles away
    5·1 answer
  • tell us things u did as a kid but don't want to admit to it (best gets brainly 5 stasr and a thank you)
    13·2 answers
  • Office 365 ProPlus can be deployed to your enterprise. When doing so, which tool enables you to choose the language, hardware ar
    5·1 answer
  • You are given a graph G = (V, E) with positive edge weights, and a minimum spanning tree T = (V, E’) with respect to these weigh
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!