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
What kind of device is hardware capable of transferring items from computers t and devices to trans?
Volgvan
Your answer is:
communications device

I hope this helps! :)
7 0
3 years ago
How can you check data on devices connected through an iot network?
vampirchik [111]

<em>Internet of Things(IoT)</em> which could be described as a group of interconnected systems or objects which are able to communicate, transmit and exchange data using <em>smart technology</em> and sensors. Data can be checked and monitored on these devices using Dashboards.

  • Dashboards provides a graphical representation of information about interconnected IoT objects or devices. They are produced using data collected from interconnected objects.

  • Since all objects are interconnected, devices use data which are are stored in storage or memory locations. These data are then used to prepare information displayed on dashboards.

Therefore, dashboards provides an interface to view data information about IoT connected devices.

Learn more :brainly.com/question/24958568

6 0
3 years ago
Read 2 more answers
Which screen should be open to customize or personalize a desktop background?
stira [4]
Display Properties is the screen that should be open
5 0
3 years ago
Read 2 more answers
What protocol allows us to use a domain name like .com instead of an ip address?
san4es73 [151]
The answer is DNS (Domain Name System)

IP addresses are difficult to remember and therefore, the internet allows you to specify a computer using a host name. The same case happens to DNS. It maps domain names to IP addresses. Domain names are alphabetic making them easier to remember.



4 0
3 years ago
Pat creates a table in a spread sheet
Anna11 [10]

Answer:

Explanation:

Details?

7 0
4 years ago
Other questions:
  • Assign to avg_owls the average owls per zoo. Print avg_owls as an integer. Sample output for inputs: 1 2 4 3
    7·1 answer
  • a. Write a function called fizzbuzz. This function will take 1 number as a parameter. The function will print all numbers from 0
    15·1 answer
  • ​______________________ is a general security term that includes computer​ viruses, worms, and trojan horses.
    13·1 answer
  • To save time and avoid formatting errors, you can use the__ to apply custom formatting to other places in your presentation and
    13·1 answer
  • Who can pick up GPS signals
    14·1 answer
  • Software that interprets commands from the keyboard and mouse is also known as the
    15·2 answers
  • What are the coordinates of the origin point? (Select the best answer.)
    10·1 answer
  • If you need to provide a storage server with fault tolerance through the use of multiple paths between the server and the actual
    14·1 answer
  • Pls answer this
    5·1 answer
  • Select the best answer from the drop-down menu. Sometimes people feel threatened by new ideas and different ways of doing things
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!