#Last problem, you wrote a function that generated the
all-
#time win-loss-tie record for Georgia Tech against any other
#team.
#
#That dataset had a lot of other information in it. Let's
#use it to answer some more questions. As a reminder, the
#data will be a CSV file, meaning that each line will be a
#comma-separated list of values. Each line will describe one
#game.
#
#The columns, from left-to-right, are:
#
# - Date: the date of the game, in Year-Month-Day format.
# - Opponent: the name of the opposing team
# - Location: Home, Away, or Neutral
# - Points For: Points scored by Georgia Tech
# - Points Against: Points scored by the opponent
#This line will open the file:
record_file =
open('../resource/lib/public/georgia_tech_football.csv', 'r')
#Here, add any code you want to allow you to answer the
#questions asked below over on edX. This is just a sandbox
#for you to explore the dataset: nothing is required for
#submission here.
spring2016.csv:
Date,Opponent,Location,Points For,Points Against
2016-12-31,Kentucky,Neutral,33,18
2016-11-26,Georgia,Away,28,27
2016-11-19,Virginia,Home,31,17
2016-11-12,Virginia Tech,Away,30,20
2016-11-05,North Carolina,Away,20,48
2016-10-29,Duke,Home,38,35
2016-10-15,Georgia Southern,Home,35,24
2016-10-08,Pittsburgh,Away,34,37
2016-10-01,Miami-FL,Home,21,35
2016-09-22,Clemson,Home,7,26
2016-09-17,Vanderbilt,Home,38,7
2016-09-10,Mercer,Home,35,10
2016-09-03,Boston College,Neutral,17,14
Who was the first team Georgia Tech ever played against?
How many points has Georgia Tech scored all-time against Auburn?
How many points has Auburn scored all-time against Georgia Tech?
What is Georgia Tech's all-time record in home games? Enter your response in the same style as the previous problem's output, Wins-Losses-Ties; for example, 100-50-25. incorrect
What was Georgia Tech's record in all games played in the 2009 calendar year? Enter your response in the same style as the previous problem's output, Wins-Losses-Ties; for example, 100-50-25. incorrect
What is Georgia Tech's all-time record in the month of October? Enter your response in the same style as the previous problem's output, Wins-Losses-Ties; for example, 100-50-25. incorrect
Georgia Tech played in the SEC from 1933 to 1963. What was its record during this time? Enter your response in the same style as the previous problem's output, Wins-Losses-Ties; for example, 100-50-25. incorrect
Against what team has Georgia Tech scored the most points? incorrect
What is one of the two teams that Georgia Tech has played, and yet has never scored any points against? Name either team. incorrect
How many teams has played Georgia Tech and never scored a point? incorrect
Against what team does Georgia Tech have the highest scoring differential (points for minus points against) all-time? incorrect
Among teams that Georgia Tech has played at least 5 times, against which team does Georgia Tech have the highest average score differential (points for minus points against, divided by number of games)?
In: Computer Science
Two candidates are competing in a majority rule election with 7 voters. The possible policies are ordered on a number line and creatively labeled {1, 2, 3, 4, 5, 6, 7}. Each policy is the favorite of one voter, and each voter has single peaked preferences. The candidates, L and R, announce policies, and whomever gets the most votes wins and implements the policy she announced. (Each voter votes for whichever candidate they strictly prefer. If a voter is indifferent, she allocates exactly half a vote to each candidate. If the candidates tie, they flip a coin, and the winner of the coin toss wins the election and implements the policy she announced.) Unlike the Downsian model, the candidates also have single peaked policy preferences. Candidate L’s favorite policy is 2. Candidate R’s favorite policy is 6. (Politics is pretty polarized these days.) In addition, the winning candidate obtains 10 jollies from winning the election.
So:
• if L wins with a policy of k in {1,2,3,4,5,6,7}, then L obtains −|2 − k| + 10 jollies, and R obtains −|6 − k| jollies.
• If R wins with a policy of j in {1,2,3,4,5,6,7}, then candidate L obtains −|2 − j| jollies, and R obtains −|6 − j| + 10 jollies.
(a) If L announces a policy of 4, what is R’s best response?
(b) Is it a Nash equilibrium of this game for each candidate to announce 4?
(c) Is it a Nash equilibrium for each candidate to announce her ideal point?
(d) Does your answers change if the candidates each obtain 2 jollies from winning the election?
In: Economics
Write the functions necessary to simulate a gambling game with the following rules:
The winner is the player who has a total closest to 9 without going over.
1. The player "rolls" 2 dice (6 sided dice)
2. The computer "rolls" 2 dice (6 sided dice)
3. The user is asked whether they want to roll one more time. If they indicate they do, another dice is rolled and added to the player's total.
4. A message is printed indicating the winner. In the case of a tie, the player wins. If both the computer and player go over 9, the computer wins.
5. YOU MAY ASSUME THAT THE USER ENTERS A VALID INTEGER (1 or 2) AS THEIR CHOICE.
You may NOT change the main function except to insert the if statement and print statements as indicated.
# define functions
def rollDice():
# function returns a random number between 1 and 6
def userWon(t1, t2):
# function accepts player total and computer total
# function returns true if player wins
# function returns false if computer wins
def main():
# each player rolls two Dice
player = rollDice() + rollDice()
computer = rollDice() + rollDice()
# ask the player if they want to roll again
again = int(input("Please enter 1 to roll again. Enter 2 to
hold."))
# roll again if needed and add to player's total
if again == 1:
player = player + rollDice()
# insert your if statement here to determine the
winner
# and your appropriate print statements
main()
In: Computer Science
hysics_2_2.4
A Helium with a volume of V0 = 1m3 is contained in a cylindrical vessel at a of temperature t0 = 0 C under a piston of mass m = 1 t, which moves smoothly (without friction).
The piston has a cross-sectional area of A = 0.5m2.
The atmospheric pressure is p0 = 973 hPa.
What quantity of heat is required to heat the helium to a temperature of t = 300°C? How big is the change of the inner Energy of helium?
Thank you so much for help! I really appreciated!
In: Physics
Refrigerant 134a, initially (state 1) a saturated liquid at -80C, is contained in a piston-cylinder assembly. The water undergoes a process to the corresponding saturated vapor (state 2), during which the piston moves freely in the cylinder. The change of state is brought about by heating the water as it undergoes an internally reversible process at constant pressure and temperature. If the mass of the refrigerant is 0.1 kg, determine (a) heat transfer using first law of thermodynamics in kJ and (b) heat transfer using second law of thermodynamics in kJ.
In: Mechanical Engineering
Water in a piston-cylinder assembly is at 1 MPa, 500◦C. There are two stops, a lower one at which Vmin = 1 m3 and an upper one at Vmax = 3 m3. The piston is loaded with a mass and outside atmosphere such that it floats when the pressure is 500 kPa. This setup is now cooled to 100◦C by rejecting heat to the surroundings at 20◦C. a. Show the path of the process on T-V and P-V diagrams. b. Determine the heat transferred and work done during this process.
In: Other
A piston with a volume of 0.5 m ^ 3 contains 0.9 kg of water at a pressure of 0.2 MPa. Heat is transferred to the cylinder until the temperature of the steam at constant pressure is 250 ° C. What happens if the change in kinetic and potential energy is neglected?
A piston with a volume of 0.5 m ^ 3 contains 0.9 kg of water at a pressure of 0.2 MPa. Heat is transferred to the cylinder until the temperature of the steam at constant pressure is 250 ° C. What happens if the change in kinetic and potential energy is neglected?
In: Mechanical Engineering
0.5 mole of a monatomic ideal gas is loaded into a cylinder and contained by a frictionless piston. The piston is set so that there is an initial volume of 2L. The gas in the cylinder is at a temperature of 298K. The gas is allowed to expand adiabatically against 1 atm of pressure. Calculate V/n initial, q per mole, w per mole, delta U per mole, delta S per mole and delta H per mole. What is the final temperature of the gas in Kelvin and Celcius?
In: Chemistry
Powerball. In this assignment you are to code a program that selects 20 random non-repeating positive numbers (the Powerball Lottery numbers), inputs three numbers from the user and checks the input with the twenty lottery numbers. The lottery numbers range from 1 to 100. The user wins if at least one input number matches the lottery numbers.
As you program your project, demonstrate to the lab instructor displaying an array passed to a function. Create a project titled Lab6_Powerball. Declare an array wins of 20 integer elements.
Define the following functions:
Hint: Array elements are assigned 0, which is outside of lottery numbers' range, to distinguish elements that have not been given lottery numbers yet.
Passing an array as a parameter and its initialization is done similar to the code in this program.
#include <iostream>
using std::cout; using std::endl; using std::cin;
// initializes the array by user input
void fillUp(int [], int);
int main( ) {
const int arraySize=5;
int a[arraySize];
fillUp(a, arraySize);
cout << "Echoing array:\n";
for (int i = 0; i < arraySize; ++i)
cout << a[i] << endl;
}
// fills upt the array "a" of "size"
void fillUp(int b[], int size) {
cout << "Enter " << size << " numbers: ";
for (int i = 0; i < size; ++i)
cin >> b[i];
}Hint: Looking for the match is similar to looking for the minimum number in this program.
#include <iostream>
using std::cout; using std::endl; using std::cin;
int main(){
const int arraySize=5;
int numbers[arraySize]; // array of numbers
// entering the numbers
cout << "Enter the numbers: ";
for(int i=0; i < arraySize; ++i)
cin >> numbers[i];
// finding the minimum
int minimum=numbers[0]; // assume minimum to be the first element
for (int i=1; i < arraySize; ++i) // start evaluating from second
if (minimum > numbers[i])
minimum=numbers[i];
cout << "The smallest number is: " << minimum << endl;
}
Hint: Use srand(), rand() and time() functions that we studied earlier to generate appropriate random numbers from 1 to 100 and fill the array. Before the selected number is entered into the array wins, call function check() to make sure that the new number is not already in the array. If it is already there, select another number.
The pseudocode for your draw() function may be as follows:
declare a variable "number of selected lottery numbers so far",
initialize this variable to zero
while (the_number_of_selected_elements is less than the array size)
select a new random number
call check() to see if this new random number is already in the array
if the new random number is not in the array
increment the number of selected elements
add the newly selected element to the array
#include <iostream>
using std::cout; using std::endl; using std::cin;
// initializes the array by user input
void fillUp(int [], int);
int main( ) {
const int arraySize=5;
int a[arraySize];
fillUp(a, arraySize);
cout << "Echoing array:\n";
for (int i = 0; i < arraySize; ++i)
cout << a[i] << endl;
}
// fills upt the array "a" of "size"
void fillUp(int b[], int size) {
cout << "Enter " << size << " numbers: ";
for (int i = 0; i < size; ++i)
cin >> b[i];
}
The pseudocode your function main() should be as follows:
main(){
declare array and other variables
assign(...) // fill array with 0
draw(...) // select 20 non-repeating random numbers
iterate three times
entry(...) // get user input
use check () to compare user input against lottery numbers
if won state and quit
printOut(...) // outputs selected lottery numbers
}
Note: A program that processes each element of the array separately (i.e. accesses all 20 elements of the array for assignment or comparison outside a loop) is inefficient and will result in a poor grade.
Note 2: For your project, you should either pass the array size (20) to the functions as a parameter or use a global constant to store it. Hard-coding the literal constant 20 in function definitions that receive the array as a parameter is poor style. It should be avoided.
In: Computer Science
Suppose you ran your elevator simulation program N times with
different random number seeds to generate N independent
measurements of the average travel time
X1, X2,⋅⋅⋅, XN
a. State the correct formula for the 95% confidence interval for
the global average travel time across all N runs assuming that each
run of your simulation program was long enough to assume that the
average travel times across different runs have an i.i.d. normal
distribution. [HINT: Remember to use the t-distribution, because
your formula only has access to the sample variance.]
b. Suppose you increase the total number of runs, N, from 9 to 36. How does that affect the confidence interval in part (a), assuming the sample mean and sample variance do not change significantly.
c. Now suppose you must reduce the width of the confidence interval to 1/10th of its size when N = 36. Estimate how many additional runs of your simulation will be needed to satisfy this requirement.
In: Statistics and Probability