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
Mrac [35]
2 years ago
8

Write a Python function that will accept as input three string values from a user. The method will return to the user a concaten

ation of the string values in reverse order. The function is to be called from the main method.
Computers and Technology
1 answer:
Aleks04 [339]2 years ago
5 0

Answer:

Following are the program in python language

def cat_rev(x,y,z): # function definition  

   x=x[::-1]# reverse the first string  

   y=y[::-1]# reverse the second string  

   z=z[::-1]# reverse the third string  

   z=x+y+z;  #concat the string

   return(z)#return the string

   #main method

s=input("Enter the first string:") #read the first string

r=input("Enter the second string:")#Read the second string  

t=input("Enter the third string:")#Read the third string by user

rev1= cat_rev(s,r ,t ) #function calling

print(rev1)# display reverse string

Output:

Enter the first string:san

Enter the second string:ran

Enter the third string:tan

nasnarnat

Explanation:

Following are the description of program

  • In the main function we read the three value by the user in the "s", "r" and "t" variable respectively.
  • After that call the function cat_rev() by pass the variable s,r and t variable in that function .
  • Control moves to the function definition of the cat_rev() function .In this function we reverse the string one by one and concat the string by using + operator .
  • Finally in the main function we print the reverse of the concat string   .

You might be interested in
When saving a document or drawing, you determine the destination folder in which the file will be saved by?
bekas [8.4K]

making a selection in the Save in: box.<span>

</span>
8 0
2 years ago
Which one of the following oscilloscope controls is used to move the trace up and down the screen vertically
kakasveta [241]
B. is the answer to this question
3 0
2 years ago
Only the root user can modify a file that has the immutable attribute set.
Vladimir79 [104]
False if the roots modify it’s capable of it’s attributed set
8 0
1 year ago
This function receives first_name and last_name, then prints a formatted string of "Name: last_name, first_name" if both names a
pishuonlain [190]

Answer:

Following are the program in the C++ Programming Language.

//set header file

#include <iostream>

//set namespace

using namespace std;

//define class

class format

{

//set access modifier

public:

//set string type variable

 string res;

//define function

 void names(string first_name, string last_name)

 {  

//set if-else if condition to check following conditions

   if(first_name.length()>0 && last_name.length()>0)

   {

     res="Name: "+last_name+", "+first_name;

   }

   else if(first_name.length()>0 and last_name.length()==0)

   {

     res="Name: "+first_name;

   }

   else if(first_name.length()==0 and last_name.length()==0)

   {

     res="";

   }

 }

//define function to print result

 void out(){

   cout<<res<<endl;

 }

};

//define main method

int main() {

//set objects of the class

 format ob,ob1,ob2;

//call functions through 1st object

 ob.names("John","Morris");

 ob.out();

//call functions through 2nd object

 ob1.names("Jhon","");

 ob1.out();

//call functions through 3rd object

 ob2.names("", "");

 ob2.out();

}

<u>Output</u>:

Name: Morris, John

Name: Jhon

Explanation:

<u>Following are the description of the program</u>:

  • Define class "format" and inside the class we define two void data type function.
  1. Define void data type function "names()" and pass two string data type arguments in its parameter "first_name" and "last_name" then, set the if-else conditional statement to check that if the variable 'first_name' is greater than 0 and 'last_name' is also greater than 0 then, the string "Name" and the following variables added to the variable "res". Then, set else if to check that if the variable 'first_name' is greater than 0 and 'last_name' is equal to 0 then, the string "Name" and the following variable "first_name" added to the variable "res".
  2. Define void data type function "out()" to print the results of the variable "res".
  • Finally, we define main method to pass values and call that functions.
3 0
3 years ago
Your college has several campuses located across the city. within each campus, the buildings are interconnected with a campus ar
iris [78.8K]

Answer:

Metropolitan Area Network (MAN)

Explanation:

8 0
1 year ago
Other questions:
  • Use ________ resolution when recording human speech in an audio file.
    14·1 answer
  • Airbags only absorb the _____ impact in a crash. initial final mid-stage smallest
    13·1 answer
  • When selecting text in word, holding down the ctrl key while clicking the mouse button will select the?
    15·1 answer
  • In Modern operating system, the __ feature has dramatically improved user productivity.
    11·1 answer
  • Assignment 1: silly sentences edhesive
    7·1 answer
  • 4
    15·2 answers
  • What happens if you create multiple accounts just to get points faster?
    6·1 answer
  • On start up, which of these windows is not displayed ?
    15·2 answers
  • PLEASE HELP
    12·1 answer
  • What is a program that includes a function parameter capable of doing?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!