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
Yakvenalex [24]
3 years ago
6

Write a function called getChar that has no function inputs, but takes in two character inputs from the user (in1 and in2) and o

utputs them to the function that calls them (The function must use input validation to make sure it is a character - Hint: use the length() function). Write another function called chars2string that takes in two character function inputs and combines them into one string that repeats each character 5 times and returns the joined string (as function output). Call both functions in a main function.

Computers and Technology
1 answer:
bearhunter [10]3 years ago
3 0

Answer:

def getChar():

   while True:

       in1 = input('Enter first char: ')

       try:

           if len(in1) != 1:

               raise

           else:

               in2 = input('Enter second char: ')

               if len(in2) != 1:

                   raise

               else:

                   break

       except:

           print('Enter just one character')

   return in1, in2

def chars2string(in1,in2):

   print(in1*5 + in2*5)

def main():

   ls = getChar()

   in1 = ls[0]

   in2 = ls[1]

   chars2string(in1, in2)

if __name__ == '__main__':

   main()

Explanation:

The programming language used is python 3.

The script first defines a function getChar and makes use of a while loop in combination with try and except blocks and IF statements, the code ensures that both inputs that are entered by the user after the prompt are 1 in length. i.e. Just one character. This function returns the two characters that were entered.

The second function that is defined is chars2string this function takes two arguments, It repeats each argument five times and returns a joined string.

Finally, the main function is defined and it calls the getChar function  first, the values that are returned by this function is assigned to two variables, that is then passed on to the chars2string function. The main function is called and the Joined string is printed to the screen.

You might be interested in
To create a link that starts an email, you code the href attribute as ________________________ followed by the email address.
timofeeve [1]
Mailto, followed by the email address.

E.g.: <span><a href="mailto:[email protected]">Mail me!</a></span>
5 0
3 years ago
While investigating an email issue, a support technician discovers no users can access their email accounts on the company’s ema
Paraphin [41]

Answer:

The question is incomplete.The full question with options is rewritten below:

"While investigating an email issue, a support technician discovers no users can access their email accounts on the company’s email server connected to the private LAN. Pinging the email server from several workstations on the LAN results in 0% packet loss.  

Which of the following is the next step the technician should take in troubleshooting this issue?  

A. Contact the ISP, inform the provider of the issue, and ask the provider to check the server.

B. Verify the server has a valid assigned IP address on the LAN subnet.

C. Escalate the problem to a server administrator to check for issues with the server.

D. Check the workstations on the LAN for APIPA configuration."

The answer is option (C): <em>Escalate the problem to a server administrator to check for issues with the server</em>

Explanation:

Being a Support Technician, you may not be able to determine the main issue with the mail server but may need to escalate further to the next category of individual that will confirm the issue with the mail server, in this case the server administrator as he may have higher access into the server at the back end or may directly liaise with the Private ISP.

7 0
3 years ago
Define a class named person that contains two instance variables of type string that stores the first name and last name of a pe
Katarina [22]

Answer:

Answered below

Explanation:

//Program is written using Java programming language.

Class Person {

private string firstName;

private string lastName;

void set firstName(string a){

firstName = a;

}

string getFirstName(){

return firstName;

}

void setLastname( string b){

lastName = b;

}

string getLastName( ){

return lastName;

}

void displayDetails( ) {

System.out.print(firstName);

System.out.print (lastName);

}

}

//Test program

Class Main{

public static void main(String args [] ){

Person person = new Person( )

person.setFirstName("Karen")

System.out.print(person.getFirstName)

person.displayDetails()

}

}

5 0
3 years ago
What were the first printed media items that graphic designers created?
laila [671]

Answer:

books

Explanation:

4 0
3 years ago
Assume that the following code exists inside a method of the class MyClass, and that this code compiles without errors: int resu
DanielleElmas [232]

Answer:

"it returns a string"  is not true about the method.

Explanation:

Since int result = book.getYearPublished() compiles without errors inside a method of the MyClass, "int result " part of the code states that the method returns an integer, not a string. getYearPublished is a mutator method and a public method in the Book class.

4 0
3 years ago
Read 2 more answers
Other questions:
  • What is a dashed line showing where a worksheet will be divided between pages when it prints?
    8·2 answers
  • Ivy is a student. She is looking for some freelance assignments during her vacation. Which of the following networking sites can
    9·1 answer
  • When pointed over a text within a paragraph, the cursor takes the shape of a/an
    10·1 answer
  • I need help. I wanna help a friend by giving him my powerpoint but I dont want him to steal my work. Is their anyway to restrict
    8·1 answer
  • i was playing a mobile game and I was a guild leader in there. one of the members were very disrespectful and they just left bec
    6·2 answers
  • You implement basic version control and go through the phase of creating a local repository. Initiate the commands to set up tha
    7·1 answer
  • quiz Flavio visits a local coffee shop on his way to school and accesses its free Wi-Fi. When he first connects, a screen appear
    7·1 answer
  • Write important of ICT in personal life?
    8·1 answer
  • What Pre-Built PC should I get? I don't have a lot of money so I'm looking for cheap options.
    8·1 answer
  • terms found in provider documentation (e.g., difficult, extensive, or unusual) would support adding modifier to a cpt code.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!