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
GarryVolchara [31]
3 years ago
7

Write a program that will prompt the user for some input, allow the user a certain amount of time to respond (e.g., 10 seconds),

and if no response is provided within the allotted time, an appropriate timeout message printed on the screen.
Computers and Technology
1 answer:
Nata [24]3 years ago
7 0

Answer:

  1. import time  
  2. import threading  
  3. response = None  
  4. def checkAnswer():
  5.    
  6.    if response != None:
  7.        time.sleep(10)
  8.        return  
  9.    print("\nInput time out")
  10. thread1 = threading.Thread(target=checkAnswer)
  11. thread1.start()
  12. response = input("Enter your name: ")
  13. print("Welcome " + response)

Explanation:

The solution code is written in Python 3.

Firstly import time and threading module (Line 1 -2). We are going to use sleep method from time module to set the interval time and also the Thread class from threading module to create a parallel running thread to check user response.  

Let's initialize response variable with None (Line 4). Next, we define a function checkAnswer (Line 6). In the function, we set time interval 10 seconds using the sleep method and create an if condition to evaluate if the response is not None simply trigger the return statement or display the message input time out (Line 7- 10).

Next, we create a thread to run checkAnswer function (Line 12 - 13). While the thread1 is running, prompt the user to input name and display their name (Line 15 -16). Since the thread1 is running, if there is no response from user, the Input time out message will be displayed.

You might be interested in
A new PKI is being built at a company, but the network administrator has concerns about spikes of traffic occurring twice a day
kipiarov [429]

Answer:

Option A (CRL) is the right answer.

Explanation:

  • Certificates with respective expiration date canceled mostly by CA generating or providing them, then it would no longer be tolerated, is considered as CRL.
  • CRL verification could be more profitable for a platform that routinely manages several clients, all having pronouncements from a certain CA, because its CRL could be retrieved once per day.

Other given choices are not connected to the given scenario. So Option A is the right one.

7 0
3 years ago
Different between input and output device​
chubhunter [2.5K]

Answer:

An input device is something you connect to a computer that sends information into the computer. An output device is something you connect to a computer that has information sent to it.

Explanation:

8 0
3 years ago
You give an object a more meaningful name by setting the object’s _________________ property.
viva [34]

Answer:

The correct answer to this question is "Name".

Explanation:

In the programming language, the object is a part of the object-oriented programming language (oops).In all (oops) programming language we use class and object. where class is a collection of data member and member function, and object is a real-world entity. An Object is an instance of a Class. When a class is created, no memory is assigned but when we create the object of the class then memory is allocated.

In this question except option (d), all options are wrong.

7 0
3 years ago
What is the difference between asking a question with few points and asking a question with many? New to Brainly :D
ANTONII [103]

Answer:

one would be more helpful and the other more vague and less convincing.

6 0
3 years ago
The protocol that enables computers on the Internet to communicate with one another is called ___
iren2701 [21]

Answer: TCP/IP

Explanation:

8 0
4 years ago
Read 2 more answers
Other questions:
  • How can the connection to salesforce be restricted only to the employee portal server? Universal containers (UC) uses a legacy E
    13·1 answer
  • Which statement correctly describe the FAFSA
    5·2 answers
  • Which of the following is a valid format symbol in Microsoft Excel? Dollar Sign, Comma, Percent Sign or all of them? I can't fig
    14·1 answer
  • As a digital forensics examiner, it’s a good idea to build a list of references for information on privacy laws in other countri
    13·1 answer
  • Your boss wants you to devise a way for remote contractors to be able to access the server desktop. There is one stipulation, ho
    12·1 answer
  • Expanding the virtual width of a game makes it possible to _______________. A. Expand the size of the player's game window B. Cr
    8·1 answer
  • Style of music that originated in New Orleans in the early 1900s
    11·2 answers
  • What are the words that make up a high-level programming language called?
    6·1 answer
  • Denise found a volume of documents in the trash bin that contained individuals, names, social security numbers and years of birt
    14·1 answer
  • Once you select a theme, you__________ change the theme’s individual elements independently of each other.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!