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
A ________ is s field or set of fields in a record that uniquely defines the record.
Archy [21]
A primary key is the answer. =)
5 0
3 years ago
1.the following code example would print the data type of x, what data type would that be?
natta225 [31]

Answer:

x = 5, the data type is integer( integer data type is for whole numbers)

2. The data type is string

3. The data type is float (float data type is for decimals)

Explanation:

6 0
3 years ago
What is output?
postnew [5]

Answer:The French and Dutch settlements differed from the Spanish colonies in that they were created mainly to trade and develop industries, while the Spanish were primarily concerned with gold and silver excavation, and then later with sugar exportation.

Explanation:The French and Dutch settlements differed from the Spanish colonies in that they were created mainly to trade and develop industries, while the Spanish were primarily concerned with gold and silver excavation, and then later with sugar exportation.

8 0
3 years ago
Whats a good way to remember to log out
Gemiola [76]
You just need to set a reminder on your phone and try and remember

3 0
3 years ago
Manufacturing product designs must be tested before they are put into production. Who is responsible for this?
hammer [34]

For testing the designs of the product prior to putting it into production, mechanics should be responsible for the same.

The information related to the mechanics engineers is as follows:

  • They are responsible for manufacturing & designing of machines & products.
  • It is the engineering branch.
  • Moreover, they are fully responsible for developing things.

Thus we can say that for testing the designs of the product prior to putting it into production, mechanics should be responsible for the same.

Learn more related to the production here: brainly.com/question/22852400

4 0
2 years ago
Other questions:
  • Which of the following statements is CORRECT? a. Multiple IRRs can occur only if the signs of the cash flows change more than on
    12·1 answer
  • Marie has never used a word processor. In 3 to 4 sentences, describe how she could benefit from using a word processor to comple
    7·2 answers
  • Write a program with total change amount as an integer input that outputs the change using the fewest coins, one coin type per l
    14·1 answer
  • What should be included in research for a problem statement? Select all that apply
    13·2 answers
  • What is DMTS. Explain it​
    10·2 answers
  • Write a program whose inputs are three integers, and whose output is the smallest of the three values. Ex: If the input is: 7 15
    5·1 answer
  • You saved a file on drive C go your computer. You want to find and open the file. Which of the following programs will you use t
    14·1 answer
  • Can anyone please help me out
    10·1 answer
  • Describe the Order of Operations in Java programming.
    11·1 answer
  • Write a recursive decent algorithm for a java while statement, a Javas if statement , an logical/mathematical expression based o
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!