PYTHON
The game of Morra is a hand game that dates back to ancient Greece and Rome. In the real game, any number of players can play, but for this question we will assume two players only. The game is played in rounds. Each round, both players throw out one hand showing between 0 and 5 fingers and simultaneously call out what they think the sum of the fingers on the hands of all players will be. Any player who guesses correctly gets a point. The first player to 3 points wins. You will write a program that simulates a two-player game of Morra. Your program must do the following for each round of play until the game is over: • At the beginning of each round, print out the round number. The first round is round 1. • Read from the console the number of fingers shown by player 1, the number of fingers shown by player 2, player 1’s guess at the sum, and player 2’s guess at the sum. • Print to the console whether any players made a correct guess, and if so, that player’s new point total. If neither player guessed correctly, print a message indicating this. Note that BOTH players might guess correctly, in which case they both earn a point! Once the game is over, print the final outcome of the game. There are a few possibilities: • Print Player X wins! where X is either 1 or 2 depending on which player won. • If, however, the winning player won by a score of 3 to 0, instead print Player X wins a glorious victory!, again where X is either 1 or 2 as appropriate. • It is possible that the game is a tie. For example, if the score is 2 to 2, and both players guess correctly in the next round, both players will have three points when the game ends. In such a case, instead of printing either of the above messages, print It’s a tie!.
(a) Remember: you don’t have to generate player moves randomly. You are reading them from the console each round. Think of your program as the referee — it asks for the players moves each round using console input, then reports on the outcome of each round using console output, and finally prints the outcome of the game. (b) Your program only has to play one full game. To referee another game, run the program again! (c) You may assume that the user enters only valid data. That is, you do not have to actually check whether player moves are between 0 and 5 and that their guesses are between 0 and 10. Just assume that valid values are always entered.
In: Computer Science
Find the fundamental frequency and the frequency of the first three overtones of a pipe 55.0 cm long, if the pipe is open at both ends.
Please enter your answer as four numbers, separated with commas.
Find the fundamental frequency and the frequency of the first three overtones of a pipe 55.0 cm long, if the pipe is closed at one end.
Please enter your answer as four numbers, separated with commas.
If the pipe is open at both ends, what is the number of the highest harmonic that may be heard by a person who can hear frequencies from 20.0 Hz to 2.00×104 Hz?
If the pipe is closed at one end, what is the number of the highest harmonic that may be heard by a person who can hear frequencies from 20.0 Hz to 2.00×104 Hz
In: Physics
A website for a small motel chain averages seven visitors every ten minutes. Solve the probability questions for Scenario 5 by hand. (Round all probabilities to 4 decimals)
What is the mean number of visitors in a 3-minute period?
What is the probability of no visitors in a 3-minute period?
What is the probability of exactly one visitor in a 3-minute period?
What is the probability of exactly two visitors in a 3-minute period?
What is the probability of three or more visitors in a 3-minute period?
What is the expected number of visitors to the website in six minutes?
What is the variance of the number of expected visitors to the website in six minutes?
What is the standard deviation of the number of expected visitors to the website in six minutes? (Round to two decimals
In: Statistics and Probability
Two coins are tossed and a (6-sided) die is rolled. Describe a sample space(probability space), together with the probability, on which such a situation can be modeled. Find the probability mass function of the random variable whose value is the sum of the number on the die and the total number of heads.
In: Statistics and Probability
One argument to be made about curling at a very elite level, like the men’s world championships, is that all the teams are equally highly skilled and whoever wins is mostly a function of chance (or use the term “luck” if you prefer). You’ve decided to test this idea by looking at the number of points scored by the Canadian team in comparison to the number of points scored by their competitors in each of their games. At the time of setting this exam, the Canadian team has played 8 roundrobin games. The following table contains the scores of the Canadian team and their opponents for each of those 8 games. Do you have enough evidence to claim (at α = .05) that there is a significant difference in the number of points scored by the Canadians and their opponents?
Canadians 6 |11 | 9 | 8 | 10| 7 | 3 | 4
Opponent 5 | 3 | 5 | 6 | 2 | 4 | 9 | 9
In: Statistics and Probability
I need to implement a method that removes any duplicate items in a list and returns the new values
private static linkedlist removeDuplicates(linkedlist
list)
{
return list;
}
In: Computer Science
Question 1
The probability that a teacher will see 0, 1, 2, 3, or 4 students
(a) What is the probability that the teacher see 3 students?
(b) What is the probability that the number of students the teacher will see is between 1 and 3 inclusive?
(c) What is the expected number of students that the teacher will see?
(d) What is the standard deviation?
Question 2
The probability that a house in an urban area will be burglarized is 5%. A sample of 50 houses is randomly selected to determine the number of houses that were burglarized.
(a) Define the variable of interest, X.
(b) What are the possible values of X?
(c) What is the expected number of burglarized houses?
(d) What is the standard deviation of the number of burglarized houses?
(e) What is the probability that none of the houses in the sample was burglarized?
Question 3
A sales firm receives an average of three calls per hour on its toll-free number. Suppose you were asked to find the probability that it will receive at least three calls, in a given hour:
(a) (i) which distribution does this scenario fit and why?
(ii) define the variable of interest, X.
(iii) what are the possible values of X?
(b) What is the probability that in a given hour it will receive at least three calls?
In: Statistics and Probability
A computer game simulates drawing three coloured balls from a basket. The basket contains red balls (colour #1), green balls (colour #2) and yellow balls (colour #3). If certain combinations of red, green and/or yellow appear, the player wins the game.
The player wins if
otherwise the player loses.
Write a Python program to simulate this coloured ball game by randomly generating 3 integer values between 1 and 3 (inclusive), and printing whether the player has won or lost the game.
To randomly generate a number between and including 1 and 3, use the randintmethod from random library module. For example, x = random.randint(1,100) will automatically generate a random integer between 1 and 100 (inclusive) and store it in x.
Sample output 1:
Random numbers: 3 1 2 You lose.
Sample output 2:
Random numbers: 3 3 3 You win!
In: Computer Science
This game is meant for two or more players. In the game, each player starts out with 50 points, as each player takes a turn rolling the dice; the amount generated by the dice is subtracted from the player’s points. The first player with exactly one point remaining wins. If a player’s remaining points minus the amount generated by the dice results in a value less than one, then the amount should be added to the player’s points. (As an alternative, the game can be played with a set number turns. In this case, the player with the amount of points closest to one, when all rounds have been played, wins.)
Write a program that simulates the game being played by two players. Use the Die class that was presented in Chapter 6 to simulate the dice. Write a Player class to simulate the players. (in java)
die.java
import java.util.Random;
public class die
{
private int sides;
private int value;
public die()
{
sides = 6;
roll();
}
public void roll()
{
Random r = new Random();
value = r.nextInt(sides+1);
}
public int getValue()
{
return value;
}
public int getSides()
{
return sides;
}
}
In: Computer Science
A company pays its employees an average wage of $3.25/hour with a standard deviation of $0.60. If the wages are approximately normally distributed, determine: [5x4=20pts] …graph a normal curve in all 4 parts.
a. The probability that randomly chosen worker has the hourly wage less than $3.
b. the proportion of the workers getting wages between $2.75 and $3.69 an hour
c. the minimum wage of the highest 8% of all workers.
In: Statistics and Probability