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
Leto [7]
2 years ago
13

In Python please.

Computers and Technology
1 answer:
SOVA2 [1]2 years ago
5 0

Answer:

negatives = []

zeros = []

positives = []

while True:

   number = input("Enter a number: ")

   if number == "":

       break

   else:

       number = int(number)

       if number < 0:

           negatives.append(number)

       elif number == 0:

           zeros.append(number)

       else:

           positives.append(number)

for n in negatives:

   print(n)

for z in zeros:

   print(z)

for p in positives:

   print(p)

Explanation:

Initialize three lists to hold the numbers

Create a while loop that iterates until the user enters a blank line

Inside the loop:

If the number is smaller than 0, put it in the negatives list

If the number is 0, put it in the zeros list

Otherwise, put the number in the negatives list

When the while loop is done, create three for loops to print the numbers inside the lists

You might be interested in
Which visual aid should Emil use to compare and contrast the political systems in three countries?
BaLLatris [955]
A vent diagram. It helps to outline the differences and the similarities between the three countries
5 0
3 years ago
Question 2 In this question you are asked to calculate probabilties for the discrete uniform and exponential distribution. Make
sasho [114]

Answer:

Hi there! The question is asking to make changes to the H3_Q2.java program however there is no such program attached. Nevertheless, the requirements in the question can be addressed in a new H3_Q2.java program that i've listed below.

Explanation:

We can use the Scanner util in Java for prompting user input. The method nextInt() and nextDouble() allow only values of types "int" and "double" respectively. I have used the "switch" statement to direct the program based on user selection of menu item. The checks are printed with the "System.out.println" command and the program exits in case of error or invalid input. Finally, the calculation of probability simply requires you to replace the comment with the formula for the probability calculation based on the method chosen.

H3_Q2.java

import java.util.Scanner;

public class H3_Q2 {

 public static void main(String args[]) {

   // print main menu for user selection

   System.out.println("Please type 1 to select 'discrete uniform' or 2 to select 'exponential'");

   Scanner scan = new Scanner(System.in);

   int selection = scan.nextInt();

   switch(selection) {

     case 1:

       // discrete uniform

       System.out.println("Please enter a lower bound value a: ");

       int a = scan.nextInt();

       System.out.println("Please enter a upper bound value b: ");

       int b = scan.nextInt();

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

       int x = scan.nextInt();

       if (b <= a) {

         System.out.println("The upper bound value b should be greater than the lower bound value a");

         System.exit(0);

       }

       if (a > x) {

         System.out.println("The value x should be greater than the lower bound value b");

         System.exit(0);

       }

       if (b < x) {

         System.out.println("The value x should be greater than the lower bound value b");

         System.exit(0);

       }

       break;

     case 2:

       // exponential

       System.out.println("Please enter a lambda value for exponential: ");

       double lambda = scan.nextDouble();

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

       double d_x = scan.nextDouble();

       if (d_x <= 0.0) {

         System.out.println("The value x should be greater than 0");

         break;

       } else {

         // calculate P(X = x) and P(X ≤ x)

         // result = calculateExponential()

         System.out.println("The calculation for the exponential method given the lambda value " + lambda + " and the value of x " + d_x + " is: ");

       }

       break;

     default:

       System.out.println("Invalid input. Exiting..");

       break;

   }

 }

}

7 0
3 years ago
Anyone know websites that teach how to code (idc if you need to buy a subscription.)
Anna11 [10]

Answer:

code.org

Explanation:

4 0
3 years ago
______ refers to the physical or logical arrangement of a network.
yarga [219]
Topology refers to the physical or logical arrangement of a network.
3 0
3 years ago
When you turn on a computer, Windows starts and displays a ____ consisting of the time and date.
nata0808 [166]

It really depends what device you're on.


For example, my wifes laptop shows a lock screen, then it shows a sign in screen.

My laptop shows ONLY the sign in screen.


My old laptop shows a sign in screen with the date and time. So I dunno man

7 0
3 years ago
Read 2 more answers
Other questions:
  • true or false manual handling of materials accounts for the primary source of energy in the workplace
    13·2 answers
  • Sidney works in the accounting department. His boss just assigned him a task that involves creating budget formulas for the comp
    12·1 answer
  • Which wireless communication technology is most likely used when synchronizing device information to an automobile?
    9·1 answer
  • What type of network is capable of delivering voice, video streams, text, and graphics between many different types of devices o
    15·1 answer
  • If you will be giving your presentation to an audience, you can practice your presentation by using View, ___________, to rehear
    14·1 answer
  • Write a C program that includes a function of type double called divemaster accepts two double arguments (you must write the div
    15·1 answer
  • The data-linking feature that allows Internet users to skip directly from a highlighted word to a related file in another comput
    12·2 answers
  • Video-sharing sites such as youtube and vimeo provide a place to post short videos called clips, true or false?
    10·1 answer
  • They are correct? thank you!
    6·2 answers
  • Explain in detail, how the Depth Wavelet Transform (DWT) algorithm works, specifically with respect to EEGs (a non-invasive brai
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!