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
jenyasd209 [6]
2 years ago
8

AP CSP - Write a program that takes 10 random numbers from 1 to 12 inclusively and averages them together.

Computers and Technology
1 answer:
Amanda [17]2 years ago
3 0

Answer:

follows are the correct python code to this question:

import random as r#import random package as r

import statistics as s #import statistics package as s

l= r.sample(range(0,12),10)#defining l variable that use random function to store 10 random numbers

avg= s.mean(l)#defining avg variable for calculate average of l

print('List of random number are: ', l)#print list of random numbers

print("The random number Average is: ", avg)#print average value

Output:

List of random number are:  [4, 10, 6, 0, 3, 5, 1, 7, 11, 2]

The random number Average is:   4.9

Explanation:

In question 1:

In the given code, two packages are imported, which are "random and statistics", in which "random" is used to generate a random number, and "statistics" is used to calculate the average value.

In the code, the "l" variable is used, which uses a random function and store 10 random numbers, and an "avg" variable is defined that calculates the average value. In the last step, the print method is used that print number and its average value.

In question 2:

The given code is wrong because it only calls the "random" method, which is not defined.

You might be interested in
During a move, employee workstations were disconnected from the network and reconnected in new offices. However, after the move
Troyanec [42]

Answer:

Make sure the cables are functional and properly plugged.

Explanation:

For the fact that everything was working perfectly before the move, but after the move, it was noticed that a few workstations cannot get a valid IP, the first thing that is required to be checked is to ensure that the cables are properly plugged, and if they are, make sure that you test for the functionality of the cables. It is only after these checks and the problem persist, that further troubleshooting is required.

5 0
3 years ago
Assume that an array of Integers named a that contains exactly five elements has been declared and initialized. In addition, an
just olya [345]

Complete Question:

Assume that an array of Integers named a that contains exactly five elements has been declared and initialized. In addition, an int variable j has also been declared and initialized to a value somewhere between 0 and 3.

Write a single statement that assigns a new value to the element of the array indexed by j. This new value should be equal to twice the value stored in the next element of the array (i.e. the element after the element indexed by j ). Do not modify any other elements of the array!

Answer:

a[j] = 2 * a[j+1];

Explanation:

Since the array is named a and its indexes are referenced by the variable j

it means the elements of the array will be a[j] for (j=0; j=1;j=2).

The first element in the array (j=0) will be a[0], second element will be a[1] and so on.

The statement a[j] = 2 * a[j+1]; assigns a new value to the element of the array indexed by j, the  value is equal to twice the value stored in the next element of the array (j+1).

4 0
3 years ago
How would you create a loop that never ends?
34kurt

Answer:

the answer is d use the forever block

Explanation:

I took the test and I got it right but sometimes it is different for others

8 0
2 years ago
Which of the following sorting algorithms is described by this text? "Split the array in two parts. Take each part, and split it
BartSMP [9]

Answer:

Option(B) i.e "Merge sort " is the correct answer to the given question .

Explanation:

The merge sort follow the approach of divide and conquer technique .It means firstly it divided the given array into the sub parts that sub parts are sorted in comparing the first  value with the adjacent value and perform selection sorting in them it means we swap the value if necessary. This process will continue until all the elements are checked .

  • When the sub parts are  arranged  then we will combine them and getting the new or original array that is in sorted order.
  • When we perform the merge sort  the extra memory is used which is drawback of merge sort .
  • All the other options are not Splitting  the array in two parts and perform sorting so these are incorrect option .
5 0
2 years ago
Unicode is a world standard to represent _________________
horsena [70]

Answer:

characters.

Explanation:

We need to represent characters in binary format so that they can be stored in computer memory. Earlier, ASCII (American Standard Code for Information Interchange) representation was commonly used for english characters. But ASCII was found to be insufficient for representing multilingual and special characters.Unicode character representation was developed to overcome this limitation.

8 0
3 years ago
Other questions:
  • Consider a relation representing the present position of molecules in a closed container. The attributes are the ID for the mole
    12·1 answer
  • What is the output after the following code executes?
    14·1 answer
  • What type of cable would you use to connect two hosts together in a back-to-back configuration using twisted pair cable?
    15·1 answer
  • An anagram is a word or a phrase made by transposing the letters of another word or phrase; for example, "parliament" is an anag
    7·1 answer
  • Using Visio, create a Local Area Network (LAN) consisting of 12 computers, a switch, and three printers. The switch should be in
    11·1 answer
  • Joann wants to insert page numbers at the bottom of the pages of her document using the Field option in Quick
    12·2 answers
  • What is single user operating system? Write two examples.​
    12·2 answers
  • It is a blueprint of a project​
    9·2 answers
  • Please help I’m not trying to fail
    7·2 answers
  • In what ways can information be slanted in a news report?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!