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
FREEEEE 100 POINTS COME TAKE COME COME COME<br><br> only if u like da black panther
sergejj [24]
He’s my love hehe JSJSJ

6 0
3 years ago
Read 2 more answers
WILL MARK BRAINLIEST FOR ANYONES ANSWER!
Anvisha [2.4K]

Answer:

just know that bit gonna be running when I make mine Imma have 720 fps btw today sponsored is nord VPN

4 0
3 years ago
Which of the following parameters should match in order for a pair of routers to form an adjacency when running OSPFv2? (Points
Gnom [1K]

Answer: Subnet mask

Explanation:

 Subnet mask is the type of parameter that should be match in order to form the adjacency for running the OSPFv2. The subnet mask is mainly used to identifying the address of network in the system.

The OSPF enable the router that must form an adjacency with the neighbors before sharing any type of data.

It mainly determine the neighbors links in the OSPF. The OSPFv2 router send the special type of message which is known as hello packet in the network.  

 

4 0
3 years ago
Billy used to take care of his laptop. However, one day he lost his laptop. He lost all his data, and there was no way to retrie
Bad White [126]

Answer: D. He did not create a back up of his data.

Explanation: He lost his data, so he did not back it up in case he lost his laptop.

6 0
3 years ago
Gabby is creating a game in which users must create shapes before the clock runs out. Which Python module should Gabby use to cr
igomit [66]
Uhh i think the answer is A
6 0
3 years ago
Read 2 more answers
Other questions:
  • HELP I don't understand this
    14·2 answers
  • What is a Photojournalist
    5·1 answer
  • You get a BRAINLIEST if you help me ASAP!
    11·2 answers
  • A major difference between digital librarians and traditional librarians is that traditional librarians rarely work with people.
    15·2 answers
  • To complete this quest, answer the following questions in the submission box below. Make x an array going from 0 to 100 by steps
    15·1 answer
  • Your ___ can provide hardware firewall protection for your home network where it connects to the ISP's network, just as ISP netw
    12·1 answer
  • Which objects appear on the slide after she clicks OK? Check all that apply.
    13·1 answer
  • How network diagram help in scheduling a project? Draw activity network diagram as per given
    7·1 answer
  • Vegetable farming is a good source of income explain this statement<br>​
    5·1 answer
  • Most significant effect the rotary press had on printing
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!