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
Write pseudocode instructions to carry out each of the following computational operations:1. Determine the area of a triangle gi
Zinaida [17]

Answer:

Hi there! The question is checking your knowledge on Pseudocode. Pseudocode is a high level solution written in plain English to outline the steps needed for the program to work correctly. An implementation for the different parts of the question is written below.

Explanation:

1. Determine the area of a triangle

  declare formula for area calculation of triangle as ½ * (base * height)

  validate input parameters “base” and “height”

  apply formula and return result

2. Compute the interest earned Prompt user for input 2

   declare formula for interest calculation as annual interest rate * term *     starting account balance

   validate input parameters “interest_rate” and “starting_account_balance ”

   apply formula and return result as final balance at the end of the year as the interest earned + starting balance.

3. Determine the flying time between two cities given the mileage M between them and the average speed of the airplane.

   declare formula for time calculation of triangle as time = distance / speed

   validate input parameters for mileage “M” and speed “S”

   apply formula and return result

7 0
3 years ago
Does anyone take bca on plato
SVETLANKA909090 [29]
I do. do you need help with it?
7 0
3 years ago
During which phase of system development would you acquire any necessary hardware and software?
solmaris [256]

During the <u>design</u> phase of system development, you would acquire all the necessary hardware and software.

<h3>What is SDLC?</h3>

SDLC is an abbreviation for system development life cycle and it can be defined as a strategic methodology that defines the key steps, phases, or stages for the design, development and implementation of high quality systems.

In Computer technology, there are seven (7) phases involved in the development of a system and these include the following;

  • Planning
  • Analysis
  • Design
  • Development (coding)
  • Testing
  • Deployment
  • Maintenance

Also, phased implementation simply refers to an implementation methodology in which smaller portions of functionality of a system are typically implemented one at a time (one after the other).

In conclusion, we can infer and logically deduce that you would acquire all the necessary hardware and software during the <u>design</u> phase of system development.

Read more on phases here: brainly.com/question/7112675

#SPJ1

3 0
1 year ago
What is the output of the following code?
Lynna [10]

Answer:

The output is 24

Explanation:

Given

The above code segment

Required

The output

We have (on the first line):

x = 6

y = 3

z=24

result=0

On the second line:

result = 2*((z/(x-y))\%y+10)

Substitute the value of each variable

result = 2*((24/(6-3))\%3+10)

Solve the inner brackets

result = 2*((24/3)\%3+10)

result = 2*(8\%3+10)

8%3 implies that, the remainder when 8 is divided by 3.

The remainder is 2

So:

result = 2*(2+10)

result = 2*12

result = 24

<em>Hence, the output is 24</em>

8 0
2 years ago
Write an algorithm to sum to values
Elis [28]

Answer:

There is no need to make an algorithm for this simple problem. Just add the two numbers by storing in two different variables as follows:

Let a,b be two numbers.

c=a+b;

print(c);

But, if you want to find the sum of more numbers, you can use any loop like for, while or do-while as follows:

Let a be the variable where the input numbers are stored.

while(f==1)

{

printf(“Enter number”);

scanf(“Take number into the variable a”);

sum=sum+a;

printf(“Do you want to enter more numbers? 1 for yes, 0 for no”);

scanf(“Take the input into the variable f”);

}

print(Sum)

Explanation:

hi there answer is given mar me as brainliest

5 0
3 years ago
Other questions:
  • Which osi layer is responsible for combining bits into bytes and bytes into frames?
    8·1 answer
  • which of the following is a malicious program that can replicate and spread from computer to computer? A. Email B. Virus C. Spam
    15·1 answer
  • In this exercise, use the following variables : i,lo, hi, and result. Assume that lo and hi each are associated with an int and
    9·1 answer
  • The rule of thumb that predicts that the number of transistors on a cpu will double every two years is called ________ law.
    7·1 answer
  • the microsoft excel application is a _____ program. database word-processing spreadsheet desktop-publishing
    8·1 answer
  • What is the name for the type of flash memory that is used by mobile devices to store their apps and data?
    6·1 answer
  • Rerouting traffic using arp poisoning is an attack on ________ of a network.
    8·1 answer
  • You are comparing cryptographic solutions to implement at your organization. Which two items should you focus on when you are ev
    12·1 answer
  • A<br> is an list of steps to complete a task. *
    9·1 answer
  • In terms of technology, wich of the four devices is the most recent?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!