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]
3 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]3 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
Disk ___________________ helps improve the speed and efficiency of a hard disk.
MatroZZZ [7]
Disks “Response Time” and “Disks Throughput” have great impact on speed and efficiency of a hard disk.
5 0
4 years ago
A(n) _____ is a computerized system by which subscribers are able to communicate to all other subscribers by sending a transmiss
ololo11 [35]

Answer: Listerv

Explanation:

5 0
3 years ago
i give up on understanding and trying to pass science. ive now started clicking random letters as the choices. i actually got a
Rzqust [24]
Um okay, that's not a question so why even post it.
7 0
3 years ago
You just read an msds for acetic acid. based on what you read, what type of information is included in an msds sheet? record you
victus00 [196]
There's alot of information included in the MSDS sheet, for example the company who owns the acid, the composition of the ingredient, the hazards this may cause and how to stop them, first aid measures, and fire fighting measures, just to name a few. This sheet gives you all the information you need to be safe while working in the lab with different chemicals. 
3 0
4 years ago
Convert the Binary Number to a Decimal Number
Korolek [52]
There are convertors online for this but the answer is 5
<span />
8 0
4 years ago
Other questions:
  • If you wanted to insert pictures into a presentation which tab would you use
    6·2 answers
  • What types of data are commonly entered into a cell ?
    7·2 answers
  • PLEASE HELP I NEED RIGHT ANSWER!
    9·2 answers
  • Define data, explain its three forms, and the general steps a computer performs related to data.
    7·1 answer
  • In this chapter, you subnetted a Class C private network into six subnets. In this project, you work with a Class B private netw
    10·1 answer
  • Peter was working on a design for a magazine. He had to give his design to his team for further editing. He wanted to use a file
    8·1 answer
  • I need help ASAP please and thank you!
    11·1 answer
  • How do you print "Hello World" in the console with Python? Wrong Answers Only.
    7·2 answers
  • FREE BRAINLIEST!!!
    14·2 answers
  • Which answer below is NOT a function of a Data Scientist? O Data Exploitation O Data Strategies O Data Modeling O Data Preperati
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!