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
jenyasd209 [6]
3 years ago
12

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 and that there are at least two words in the sentence. You don't need to worry about removing any punctuation. (python)
def return_second_word(sentence):
Computers and Technology
1 answer:
Soloha48 [4]3 years ago
4 0

Answer:

Following are the program in the Python Programming Language.

# define function.

def return_second_word(sentence):

 #remove all the spaces from the sentence

 sentence=' '.join(sentence.split())

 #the list is split from spaces

 my_list = sentence.split(" ")

 #return the list

 return my_list[1]

#define main function

def main():

 #get input from the user

 se = input("Enter the sentence: ")

 #print and call the function

 print(return_second_word(se))

#condition to execute the main function

if __name__ == "__main__":

 #call main function

 main()

<u>Output:</u>

Enter the sentence: I love python

love

Explanation:

Here, we define the function i.e., "return_second_word()" and pass an argument "sentence", inside the function.

  • Remove all the spaces from the variable "sentence" and again store in the variable "sentence".
  • Set the variable "my_list" that store the split value of the variable "sentence".
  • Return the list and close the function.

Finally, we define the main function and inside the main function.

  • Get input from the user in the variable "se"
  • And pass the variable "se" in the argument list during the calling of the function "return_second_word()".
  • Then, print and call the function "return_second_word()".
  • Set the if statement to call the main function then, call the main function.
You might be interested in
Here is what my rob-lox user USED to look like, btw what is better, Samsung or apple?
____ [38]
Apple is better then Samsung
6 0
2 years ago
Read 2 more answers
Write the Python code to implement each step of the following algorithm. Your code should use descriptive variable names and per
Lina20 [59]

Answer:

# the number of pizza is initialised

# to 5

number_of_pizza = 5

# number of slice in each pizza

# is initialised to 8

slice_in_each_pizza = 8

# total number of pizza is calculated

total_number_of_slices = number_of_pizza * slice_in_each_pizza

# number of guest who respond yes

# is initialised to 10

number_of_guest_respond_yes = 10

# additional 3 guest is added to existing guest

number_of_guest_respond_yes += 3

# number of left over slice is gotten by using modulo arithmetic

number_of_left_over_slice = total_number_of_slices % number_of_guest_respond_yes

# the number of left over slice

# is printed which is 1

print(number_of_left_over_slice)

Explanation:

Missing Question Part: Use a variable to store the number of pizzas ordered as 5.

Assuming there are 8 slices in each pizza, use a variable to store the total number of slices calculated using the number of pizzas ordered.

Use another variable to store the number of guests who had responded YES as 10.

Three more people responded YES. Update the corresponding variable using an appropriate expression.

Based on the guest count, set up an expression to determine the number of left-over slices if the slices would be evenly distributed among the guests. Store the result of the expression in a variable.

The program is written in Python and it is well commented.

6 0
3 years ago
Universal Containers (UC) has decided to build a new, highly sensitive application on the Force platform. The security team at U
Tresset [83]

Use an AppExchange product that does fingerprint scanning with native Salesforce Identity  Confirmation

8 0
3 years ago
Often, the symptoms of withdrawal are __________.
guapka [62]
I would say none of the above as A, B, and C do not seem like sensible answers.
3 0
3 years ago
How long does it take to learn python
Alla [95]

Answer:

five to 10 weeks

On average, it can take anywhere from five to 10 weeks to learn the basics of Python programming, including object-oriented programming, basic Python syntax, data types, loops, variables, and functions.

:

3 0
3 years ago
Read 2 more answers
Other questions:
  • What of the following google tools support collaboration
    10·1 answer
  • What is the protocol that is used between a web browser and web server at the transportation layer?
    13·1 answer
  • What are the key goal, performance, and risk indicators?
    15·1 answer
  • which type of classroom enable students to attend lectures without being physically present with the teacher
    14·2 answers
  • In every organization, workers receive and sendinformation daily. The flow of this information should be____________.upward and
    11·1 answer
  • 1. Which of the following statements are true about routers and routing on the Internet. Choose two answers. A. Protocols ensure
    9·2 answers
  • Many Web browsers allow users to open anonymous windows. During a browsing session in an anonymous window, the browser does not
    8·1 answer
  • PLS HELP ME!! WILL GIVE BRAINLIEST
    7·2 answers
  • Risk taker positive or negative​
    8·1 answer
  • What is the difference between php and html?​
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!