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
sukhopar [10]
3 years ago
11

Write a program using Python that prompts for an integer and prints the integer, but if something other than an integer is input

, the program keeps asking for an integer. Here is a sample session:
Input an integer: abc

Error: try again.

Input an integer: 4a

Error: try again.

Input an integer: 2.5

Error: try again.

Input an integer: 123

The integer is: 123
Computers and Technology
2 answers:
Tcecarenko [31]3 years ago
7 0

Answer:

#program in Python

#read until user Enter an integer

while True:

   #try block to check integer

   try:

       #read input from user

       inp = int(input("Enter an integer: "))

       #print input

       print("The integer is: ",inp)

       break

   #if input is not integer

   except ValueError:

       #print message

       print("Wrong: try again.")

Explanation:

In try block, read input from user.If the input is not integer the print a message  in except block.Read the input until user enter an integer. When user enter an  integer then print the integer and break the loop.

Output:

Enter an integer: acs                                                                                                      

Wrong: try again.                                                                                                          

Enter an integer: 4a                                                                                                      

Wrong: try again.                                                                                                          

Enter an integer: 2.2                                                                                                      

Wrong: try again.                                                                                                          

Enter an integer: 12                                                                                                      

The integer is:  12  

trasher [3.6K]3 years ago
3 0

Answer:

Enter an integer: 4a                                                                                                      

Wrong: try again.                                                                                                          

Enter an integer: 2.2                                                                                                      

Wrong: try again.                                                                                                          

Enter an integer: 12                                                                                                      

The integer is:  12  

hope this helps

You might be interested in
Identify a true statement about decision support systems (DSSs).
Zolol [24]

Answer:

a. facilitate improvements but do not necessarily cause them.

Explanation:

Decision Support Systems are interactive Information systems that assist  decision makers in coming up with strategies that help the organisation achieve its goals .The model base of the DSS uses mathematical and statistical models to analyse information then it generates reports and suggest possible solutions that can be implemented .The system is capable of giving a specific solution and some even allow the decision makers to give input before suggesting the most applicable solution.The effectiveness of a DSS is equally as important as its efficiency .The DSS unlike the conventional decision-making process should be able to analyse information effectively and come up with solutions in the shortest possible time frame.

7 0
3 years ago
? Create a home page that introduces the rental car company. the page should have a header and footer. in the document body, it
Anestetic [448]
You need some more criteria. Is this a webpage? If so.. What language(s) are applicable for writing your web application. My profession is systems development, do I do a lot of fronte-end/ back-end development. I don't mind helping, just need some more information. If not what resource does this need to be created in?
7 0
3 years ago
Jamie found the ISBN of the book she wanted to order in the Books in Print Catalog. To remember the eleven-digit number, 1977255
algol13

Answer:

Chunking

Explanation:

Chunking refers to the process of taking individual pieces of information (called chunks) and grouping them into larger units. By grouping each piece into a large whole, you can improve the amount of information you can remember.

5 0
2 years ago
In Mandatory Access Control sensitivity labels attached to object contain what information?
larisa86 [58]

Answer:b)The item’s classification and category set

Explanation: Mandatory access control(MAC) is the security component in the computer system. It is regarding the controlling the access of the operating system by the administrator.The accessing is made limited by the MAC according to the sensitivity of the data .

The authorization for user to access the system is based on this sensitivity level known sensitivity label. The objects contain the information regarding the classification and categories or level of items. Thus, the correct option is option(b).

7 0
3 years ago
Which save as element allows a user to save a presentation on a computer?
s344n2d4d5 [400]

Answer:

This PC

Explanation:

Got it right

7 0
3 years ago
Read 2 more answers
Other questions:
  • Ryan needs to see the space available to insert content on a slide in his presentation. Which feature of a presentation program
    5·1 answer
  • GoInternet, Inc., is an Internet-access service provider that is being forced to manage numerous unwanted e-mail messages from a
    10·1 answer
  • If you've been a victim of identity theft, what should you do after contacting the company that reported the suspicious charge a
    9·1 answer
  • Create a detail report that will display all SCR courses in alphabetical order, with the course name and the instructor name in
    5·1 answer
  • Which sentence uses a pair of synonyms? Because there was so much shouting, many of the protestors began screaming in order to b
    6·2 answers
  • Discuss briefly general-purpose graphicsprimitives that contain 2D graphics library.
    15·1 answer
  • What does digital mean, in the term of computer science.
    11·1 answer
  • Write a static generic method PairUtil.minmax that computes the minimum and maximum elements of an array of type T and returns a
    7·1 answer
  • What does a hanging indent look like?
    7·1 answer
  • Why would over-50 executives have a harder time buying into the idea of social media?​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!