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
Vesna [10]
3 years ago
6

Write a program that repeatedly prompts a user for integer numbers until the user enters 'done'. Once 'done' is entered, print o

ut the largest and smallest of the numbers. If the user enters anything other than a valid number catch it with a try/except and put out an appropriate message and ignore the number. Enter 7, 2, bob, 10, and 4 and match the output below.
Computers and Technology
1 answer:
bearhunter [10]3 years ago
6 0

A program that repeatedly prompts a user for integer numbers :

biggest = none

smallest = none

while True:

input = raw_input(“Enter a number:”)

if(input == “done” break

try:

 number = float(inp)

 except ValueError:

 print “Please enter only numbers”

else

 if smallest is None:

  smallest = number;

  biggest = number;

elif number < smallest:

 smallest = number

elif num > largest:

 largest = number

Print “Greatest is “, biggest

Print “Smallest is”, smallest

In this program an input is obtained, if it is equal to the word “done”, then the program stops b printing greatest and smallest number in the given input.

If invalid inputs are given then user is prompted to enter valid number. Otherwise the value of smallest and greatest are calculated according to the input using if-else construct.

You might be interested in
You are to calculate the property tax for tax payers. You will ask the county tax clerk if they want to run the program and init
andre [41]

Answer:

Explanation:

The following code is written in Java. It creates the loop as requested and validates the information provided before continuing, if the information is invalid it prints "Invalid Information to the screen" and asks the user to enter the information again. Finally, outputing all the requested information at the end of the program. The code has been tested and the output can be seen in the attached image below.

import java.util.ArrayList;

import java.util.Arrays;

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       int totalValues = 0;

       int totalTaxes = 0;

       int count = 0;

       while(true) {

           int lotNumber, value;

           double tax;

           System.out.println("Would you like to add an Entry: 1=Yes 0=No");

           int answer = in.nextInt();

           if (answer == 1) {

               System.out.println("Please enter lot number: ");

               lotNumber = in.nextInt();

               if ((lotNumber >= 0) && (lotNumber <= 999999)) {

                   System.out.println("Please enter assessed value: ");

                   value = in.nextInt();

                   tax = value * 0.05;

                   System.out.println("Lot Number: " + lotNumber);

                   System.out.println("Property Value: " + value);

                   System.out.println("Property Tax: " + tax);

                   totalTaxes += tax;

                   totalValues += value;

                   count += 1;

               } else {

                   System.out.println("Invalid Lot Number");

               }

           } else {

               break;

           }

       }

       int average = totalTaxes / count;

       System.out.println("Total Property Values: " + totalValues);

       System.out.println("Total Property Taxes: " + totalTaxes);

       System.out.println("Average Property Tax" + average);

   }

}

8 0
2 years ago
Transparency is an important concept in policies related to the handling and use of customer data. Organizations should be trans
Tpy6a [65]

Answer: (C) Response controls

Explanation:

  According to the given question, the response control is not the necessary element while handling the users or customer data as compared to all the other given options that is individual participation, data minimization and the purpose specification.

  • The response control is basically used for exchange the data or any information in an organization but the main disadvantage is that they share all the response and information as they not wait for the request from the users.
  • The all the three other given options expect response control are the important element for handling the customer data as it helps in maintaining the Personal information.  

 Therefore, Option (C) is correct answer.  

6 0
3 years ago
Lonnie has several workbooks that contain financial and sales data. He needs to ensure that if the data in a single cell in one
Rzqust [24]

Answer: Linked cell

Explanation: I just did a test

7 0
3 years ago
Your personality is that of everyone else
lubasha [3.4K]

hmmmmm but is it really

5 0
3 years ago
Read 2 more answers
You are the owner of a movie theater upgrading to digital film, and are concerned about the cost of buying new digital equipment
Triss [41]

I would do A, as it would be better to use it and would make a good profit handling the assets

5 0
3 years ago
Other questions:
  • What Event is called when an Object collides with an non-trigger collider?
    13·1 answer
  • Need deveolpers not software
    10·2 answers
  • I want to know all part of computer system?
    9·2 answers
  • Which is the correct formula to add the values in cells A1 and B1?
    11·2 answers
  • This program outputs a downwards facing arrow composed of a rectangle and a right triangle. The arrow dimensions are defined by
    8·1 answer
  • HELP QUICKLY!!! IF YOUR RIGHT I'LL MARK YOU BRAINLIEST
    15·2 answers
  • After adjusting your seat, your _____ should be as close as possible to the backrest
    7·2 answers
  • Can somebody tell me the Minecraft command to clear an entire world and destroy every block if u Dunno please don’t answer &gt;-
    13·1 answer
  • Suppose in an Excel spreadsheet, the value in cell A1 is 25. By using the Macabacus local currency cycle shortcuts (Ctrl + Shift
    10·1 answer
  • A data use agreement is required when a researcher uses a limited data set (lds). an lds must have:_________
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!