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
Lana71 [14]
3 years ago
5

Write a Python programs to do frequency counting of the sum of two dice. Your function should accept an integer n parameter to r

un n trials (i.e., multiple rollings of the two dice); You can use the Python function randrange(1, 7) to simulate the roll of one die; After running the n trials, your function should return the sum of two dice that occurs most frequently.
Computers and Technology
1 answer:
NARA [144]3 years ago
4 0

Answer:

Explanation:

The following program uses Numpy import to detect the frequency of all the elements in an array and ouput the one that appears the most. The function creates random dice rolls and adds them to the array, looping the number of times that the trials parameter states. Then finally printing out the original array and the sum that appeared the most frequently.

from random import randrange

import numpy as np

def highestFrequency(trials):

   products = []

   for x in range(trials):

       product = randrange(1, 7) * randrange(1, 7)

       products.append(product)

   x = np.array(products)

   print("Original Array: " + str(list(products)))

   print("Most frequent value in the above array:")

   print(np.bincount(x).argmax())

highestFrequency(7)

You might be interested in
You give an object a more meaningful name by setting the object’s _________________ property.
viva [34]

Answer:

The correct answer to this question is "Name".

Explanation:

In the programming language, the object is a part of the object-oriented programming language (oops).In all (oops) programming language we use class and object. where class is a collection of data member and member function, and object is a real-world entity. An Object is an instance of a Class. When a class is created, no memory is assigned but when we create the object of the class then memory is allocated.

In this question except option (d), all options are wrong.

7 0
3 years ago
A team of researchers wants to create a program to analyze the amount of pollution reported in roughly 3,000 counties across the
omeli [17]

The option that is most likely to be a challenge in creating the program is Different counties may organize data in different ways.

<h3>What is Pollution?</h3>

Pollution is known to be a kind of bringing in of harmful materials into an environment.

These harmful things are known as pollutants. Pollutants are known to be natural and artificial that is they are created by human activity, such as trash or runoff produced by factories, etc.

Learn more program from

brainly.com/question/1538272

7 0
2 years ago
What is the exact volume of the cone​
tresset_1 [31]

Answer: You're going to have to put parameters.

Explanation: Anyways, the formula for solving a cone is V=\pi r^{2} \frac{h}{3} . Where r is the radius of the base of the cone and h is the height from the center of the base to the tip of the cone. You can google "cone volume formula" and google will show a cone volume calculator and you can type in the parameters.

7 0
3 years ago
Write a SELECT statement to create a lesson schedule for Feb 1, 2020 with the lesson date/time, student's first and last names,
Fed [463]

SELECT statement are used to retrieve data from a database table

The SELECT statement that creates the lesson schedule is:

<em>SELECT LessonDateTime, HorseID, FirstName, LastName FROM LessonSchedule JOIN Student ON LessonSchedule.StudentID = Student.ID ORDER BY LessonDateTime ASC, HorseID</em>

<h3>How to determine the SELECT statement</h3>

To write the select statement, we start by writing the following query that retrieves Lesson date/time, horse ID, first name, and last name from the lesson schedule table.

So, we have:

SELECT LessonDateTime, HorseID, FirstName, LastName FROM LessonSchedule

Next, the query would confirm the presence of a student ID in the lesson schedule table and the student table using the JOIN statement

JOIN Student ON LessonSchedule.StudentID = Student.ID

From the question, we understand that:

The result should be sorted in ascending order by lesson date/time.

This is represented as:

ORDER BY LessonDateTime ASC, HorseID

Hence, the complete query is:

SELECT LessonDateTime, HorseID, FirstName, LastName FROM LessonSchedule JOIN Student ON LessonSchedule.StudentID = Student.ID ORDER BY LessonDateTime ASC, HorseID

Read more about database at:

brainly.com/question/24223730

4 0
3 years ago
Assume that x is a variable that has been declared as an int and been given a value. Assume that twice is a method (in the same
Anastasy [175]

Answer:

Arrays are indexed from 0 in pretty much every language, except stupid Microsoft languages.

Lets say that ARR_SIZE is 5 for example.

So you have an array of 5 elements. They are indexed from 0 - 4.

arr[0] // First element

arr[4] // Last element

Therefore arr[ ARR_SIZE -1 ] is the last element of the array.

That's why for loops to iterate through arrays are wrote like:

for(int i = 0; i < ARR_SIZE; ++i)

4 0
3 years ago
Other questions:
  • If you were an online community director, you might use both chat and e-mail in your community. What are some similarities and d
    6·1 answer
  • What is best android apps​
    8·2 answers
  • Compare the encryption algorithms found in s-tools: idea, mdc, des, and 3des.
    5·1 answer
  • Most sim cards allow ___________ access attempts before locking you out.
    10·1 answer
  • Short Answer: Computer models and simulations are used to formulate, refine, and test hypotheses. Describe a scenario that could
    8·1 answer
  • Each device attached to your computer comes with a special program called a(n ________ that enables the device and operating sys
    15·1 answer
  • Microsoft words spell checker
    9·1 answer
  • What stylistic device does Reverend Jesse Jackson use in the following statement: "We must relate instead of debate; we must ins
    10·1 answer
  • A celebrity blogger you have followed for years advises readers to try a new beauty product. Before purchasing the product, a sa
    10·1 answer
  • A vending machine that serves coffee pours a varying
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!