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
sergey [27]
2 years ago
12

Write a program that generates 1,000 random integers between 0 and 9 and displays the count for each number. (Hint: Use a list o

f ten integers, say counts, to store the counts for the number of 0s, 1s, ..., 9s.)
Computers and Technology
1 answer:
masya89 [10]2 years ago
5 0

Answer:

import random

count0, count1, count2, count3,

count4, count5, count6, count7,

count8, count9, i = [0 for _ in range(11)]

while i < 1000:

   number = random.randint(0,9)

   if number == 0:

       count0 = count0 + 1

   if number == 1:

       count1 = count1 + 1

   if number == 2:

       count2 = count2 + 1

   if number == 3:

       count3 = count3 + 1

   if number == 4:

       count4 = count4 + 1

   if number == 0:

       count5 = count5 + 1

   if number == 6:

       count6 = count6 + 1

   if number == 7:

       count7 = count7 + 1

   if number == 0:

       count8 = count8 + 1

   if number == 9:

       count9 = count9 + 1

   

   i = i+1

print("0's: "+ str(count0) + "\n"+ "1's: "+ str(count1) + "\n"+

"2's: "+ str(count2) + "\n"+ "3's: "+ str(count3) + "\n"+

"4's: "+ str(count4) + "\n"+ "5's: "+ str(count5) + "\n"+

"6's: "+ str(count6) + "\n"+ "7's: "+ str(count7) + "\n"+

"8's: "+ str(count8) + "\n"+ "9's: "+ str(count9) + "\n")

Explanation:

- Initialize variables to hold the count for each number

- Initialize <em>i</em> to control the while loop

- Inside the while loop, check for the numbers and increment the count values when matched.

- Print the result

You might be interested in
Which of the phases of the software development life cycle (SDLC) would the following action take place in?
bezimeni [28]
The answer is C i'm positive
7 0
2 years ago
Use the ________ property in the html link tag to to associate a web page with a style sheet for printing.
lawyer [7]
You should use the <span>media="print" link tag to achieve this. </span>
8 0
2 years ago
Attribute variables have the same meaning as participants variables. is this true or false?​
zysi [14]

Answer:

true

Explanation:

because I said so dude

5 0
2 years ago
Question # 6
insens350 [35]

Answer:

April 30, 1993

Explanation:

On April 30, 1993, four years after publishing a proposal for “an idea of linked information systems,” computer scientist Tim Berners-Lee released the source code for the world’s first web browser and editor.

4 0
2 years ago
Select the incorrect sentence from the options given below. *
dybincka [34]

Answer:

windows explorer works as a manager for the windows.

hope it's help

6 0
2 years ago
Other questions:
  • Which of the following statements is false?
    10·1 answer
  • Switches operate on what layer of the OSI Model
    11·1 answer
  • #We've started a recursive function below called #measure_string that should take in one string parameter, #myStr, and returns i
    5·1 answer
  • Question 5 (10 points)
    12·1 answer
  • Write a class called (d) Teacher that has just a main method. The main method should construct a GradeBook for a class with two
    7·1 answer
  • ITS MAKING ME TYPE URL CODES NOW!
    6·1 answer
  • Analyze the following code: class Test { public static void main(String[] args) { System.out.println(xMethod((double)5)); } publ
    7·1 answer
  • Write a program that outputs inflation rates for two successive years and whether the inflation is increasing or decreasing. Ask
    9·1 answer
  • How do cyber criminals target user’s end devices?
    11·2 answers
  • In which of the following movies, multimedia's special effect is used ? *
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!