|
||
|
||
|
||
|
In: Finance
Describe the three types of Unemployment:
a.) Which type of Unemployment is likely to last the longest? Explain:
b.) Provide a General Graph illustrating a Business Cycle and indicate the areas of highest and lowest Unemployment.
In: Economics
In: Economics
1) Explain how Rent the Runway Unlimited subscription service works.
2) Briefly explain the steps one should take to ensure that their highest priority accounts are not compromised easily by hackers.
In: Operations Management
(SQL Coding)
Create a read only view called view_emp_salary_rank_ro that selects the last name and salary from the o_employees table and ranks the salaries from highest to lowest for the top three employees.
In: Computer Science
Which transition metal is correctly matched with its highest oxidation state??
A) Cr, 3+?
B) Mn, 5+?
C) Ti, 3+
?D) Sc, 3+
?E) Fe, 8+
In: Chemistry
Number Analysis Program (Specific Design Specifications)
Design a Python program that asks the user to enter a series of 20 numbers. The program should store the numbers in a list then display the following data: The lowest number in the list The highest number in the list The total of the numbers in the list The average of the numbers in the list
This python program must include the following functions. Your program must use the exact names, parameter lists, and follow the function descriptions provided.
def CreateNumberList(howMany): This function will accept a parameter for how many numbers to include in a list. It will create a list containing howMany elements that are random numbers in the range 1 - 500. The function return value will be the list that contains these values.
def SortList(myList): This function will accept the list of random numbers as the parameter variable. It will first use the sort() function to sort the values in the list. Then this function will use index 0 and index len(myList) - 1 to print the smallest and largest value in the list. This function does not have a return value.
def DisplayAverage(myList): This function will accept the list of random numbers as the parameter variable. If will use a for loop to iterate through each item in the list and add each value to a sum variable. You will then calculate the average of the values and display the average as the output. This function does not have a return value.
def main(): This function will begin by asking the user how many numbers they want to generate in their list. You must include an input validation loop that will not accept a number less than 1. After the input is validated, call the CreateNumberList function and store the return value in a variable, then call the SortList and DisplayAverage functions passing your list as an argument. Call your main function to execute the program.
In: Computer Science
Program Description, Interfaces, and Functionality
To create a Python tic-tac-toe game, use Python's randint function
from the random module to control
the computer's moves. To determine if the game has been won or is a
tie/draw, write at least the func-
tions: def move(), def check_cols(), def check_diag1(), def
check_diag2(), def check_rows(),
and def print_board(). Four of the functions will check if a
winning state exist. To win tic-tac-toe, a user
needs to have three of the same game pieces, either an X or an O,
in a row, column, or diagonal. When either
the player or computer wins, the game will announce a winner. Use
the provided functions def check_ifwin()
to determine if the board is in a winning state. Refer to the
example game play in this handout.
2. The def move() function will make a computer move using the
random Python module. Refer to the
skeleton code for how to move the computer.
3. The functions: def check_cols(), def check_diag1(), def
check_diag2(), def check_rows(),
will traverse the board to check for winning states. Refer to the
skeleton code for more details.
4. The def print\_board() function will print out the current state
of the board. Refer to the example
game play for the look-and-feel of the game.
5. The game of tic-tac-toe will continuously play until either the
computer or player wins or the game is a
draw. A player can then decide to play another round or exit the
game.
example:
>python.py
---
O--
---
Enter in cell for your move as a coordinate pair (e.g. 00, 10,
etc): 11
---
OX-
O--
Enter in cell for your move as a coordinate pair (e.g. 00, 10,
etc): 00
X--
OX-
OO-
Enter in cell for your move as a coordinate pair (e.g. 00, 10,
etc): 12
We have a winner!
X--
OXX #example computer wins
OOO
Do you want to try again? enter yes or no: yes
---
---
--O
Enter in cell for your move as a coordinate pair (e.g. 00, 10,
etc): 11
---
OX-
--O
Enter in cell for your move as a coordinate pair (e.g. 00, 10,
etc): 20
---
OX-
XOO
Enter in cell for your move as a coordinate pair (e.g. 00, 10,
etc): 02
We have a winner!
--X
OX- #example player wins
XOO
Do you want to try again? enter yes or no: yes
O--
---
---
Enter in cell for your move as a coordinate pair (e.g. 00, 10,
etc): 11
O--
-X-
O--
Enter in cell for your move as a coordinate pair (e.g. 00, 10,
etc): 22
O--
-XO
O-X
Enter in cell for your move as a coordinate pair (e.g. 00, 10,
etc): 02
OOX
-XO
O-X
Enter in cell for your move as a coordinate pair (e.g. 00, 10,
etc): 10
Better luck to both of you next round
OOX
XXO #example tie/draw
OOX
Please follow the instructions in bold fill the code:
from random import randint
# void function to print the board state
def print_board ( board ):
# prints the current board
print ("the board as rows and columns ")
# Boolean function to check rows for a win
def check_rows ( board ):
# X X X O O O <-check each row for a win
#
# if a win , return true
# else return false
#
return True # or False
# Boolean function to check cols for a win
def check_cols ( board ):
# X O <-check each column for a win
# X or O
# X O
# if a win , return true
# else return false
return True # or False
# Boolean function to check diagonal 1 for a
win
def check_diag1 ( board ):
# X O <-check diagonal 1 for a win
# X or O
# X O
# if a win , return true
# else return false
return True # or False
# Boolean function to check diagonal 2 for a
win
def check_diag2 ( board ):
# X O <-check diagonal 2 for a win
# X or O
# X O
# if a win , return true
# else return false
return True # or False
# Void function to control the computer 's moves uses
randint for next move
def move ( board ):
# Tip: a 2D coordinate can be computed from
# a number n using integer division and
# modulo arithmetic
#
# For example , the coordinate pairs
# (xy) 00 ,01 ,10 ,11 for a 2x2 grid with
# four cell numbers (c) 0 ,1 ,2 ,3 can be
# computed from the cell number c as:
#
# c = randint (0 ,3)
# x = c // 2; y = c % 2
print (" move ")
# Function to check if there is a winning state on the
board
def check_ifwin ( board ):
if ( check_rows ( board )):
return True
if ( check_cols ( board )):
return True
if ( check_diag1 ( board )):
return True
if ( check_diag2 ( board )):
return True
return False
# Game function of tic -tac -toe
def tic_tac_toe ():
while True :
# Create the game -board , list of lists
b= [[0 ,0 ,0] ,[0 ,0 ,0] ,[0 ,0 ,0]]
# Todo A3:
# initialize the board to an empty game piece . For example ,
'-'
# - - -
# - - -
# - - -
# keep track of moves made , computer can move max 5
times
total_moves = 0
# Play the game
while (not ( check_ifwin (b ))):
# Computer moves first / last
move (b)
print_board (b)
# Todo A3: check if computer won or reached max moves
# if ( TODO A3 )
# break
#
# Human move
# A3 optional todo : check if cell occupied by computer
# before making the move , not implemented in skeleton code
#
r = input (" Enter in cell for your move as a coordinate pair
(e.g.00 ,10 , etc ): x = int(r [0]); y = int(r [1]) b[x][y] =
'X';
# total number of moves made
total_moves +=1
# Check for winning state
if (not check_ifwin (b)):
print (" Better luck to both of you next round ")
else :
print ("We have a winner !")
# Print the game - board
print_board (b);
r = input ("Do you want to try again ? enter yes or no\n")
if(r == "no"):
break
input (" Enter any key to exit ")
# play the game
tic_tac_toe ()
In: Computer Science
One of the large photocopiers used by a printing company has a
number of special functions unique to that particular model. This
photocopier generally performs well but, because of the complexity
of its design and the frequency of usage, it occasionally breaks
down. The department has kept records of the number of breakdowns
per month over the last fifty months. The data is summarized in the
table below:
|
Number of Breakdowns |
Probability |
|
0 |
0.12 |
|
1 |
0.32 |
|
2 |
0.24 |
|
3 |
0.20 |
|
4 |
0.08 |
|
5 |
0.04 |
The cost of a repair depends mainly on the time taken, the level of
expertise required and the cost of any spare parts. There are four
levels of repair. The cost per repair for each level and
probabilities for different levels of repair are shown in table
below:
|
Repair Category |
Repair Cost |
Probability |
|
1 |
$35 |
0.50 |
|
2 |
$75 |
0.30 |
|
3 |
$150 |
0.16 |
|
4 |
$350 |
0.04 |
Based on the probabilities given in the two tables and using the
random number streams given below, simulate for each of 12
consecutive months the number of breakdowns and the repair cost of
each breakdown. Note that for each month you must compute both the
number of breakdowns, the repair cost for each breakdown (if any)
and the total monthly repair cost as well as the total annual
repair cost to answer the following questions.
Use the following random numbers in order (from left to right) for
the simulation of number of breakdowns per month:
|
Jan |
Feb |
Mar |
Apr |
May |
Jun |
Jul |
Aug |
Sep |
Oct |
Nov |
Dec |
|
0.13 |
0.21 |
0.08 |
0.09 |
0.89 |
0.26 |
0.65 |
0.28 |
0.97 |
0.24 |
0.10 |
0.90 |
Use the following random numbers in order (from left to right,
first row first - as you need them) for the simulation of repair
cost for each breakdown.
|
0.19 |
0.39 |
0.07 |
0.42 |
0.65 |
0.61 |
0.85 |
0.40 |
0.75 |
0.73 |
0.16 |
0.64 |
|
0.38 |
0.05 |
0.91 |
0.97 |
0.24 |
0.01 |
0.27 |
0.69 |
0.18 |
0.06 |
0.53 |
0.97 |
What is the annual total cost of repairs in this 12-month
simulation?
a) $1845 b) $1485 c) $1570 d) $2250 e) $1480
| A. |
$1845 |
|
| B. |
$1570 |
|
| C. |
$2250 |
|
| D. |
$1480 |
|
| E. |
$1485 |
In: Statistics and Probability
The University of California, Berkeley (Cal) and Stanford University are athletic archrivals in the Pacific 10 conference. Stanford fans claim Stanford's basketball team is better than Cal's team; Cal fans challenge this assertion. In 2004, Stanford University's basketball team went nearly undefeated within the Pac 10. Stanford's record, and those of Cal and the other eight teams in the conference, are listed in In all, there were 89 games played among the Pac 10 teams in the season. Stanford won 17 of the 18 games it played; Cal won 9 of 18. We would like to use these data to test the Stanford fans' claim that Stanford's team is better than Cal's. That is, we would like to determine whether the difference between the two teams' performance reasonably could be attributed to chance, if the Stanford and Cal teams in fact have equal skill.
To test the hypothesis, we shall make a number of simplifying assumptions. First of all, we shall ignore the fact that some of the games were played between Stanford and Cal: we shall pretend that all the games were played against other teams in the conference. One strong version of the hypothesis that the two teams have equal skill is that the outcomes of the games would have been the same had the two teams swapped schedules. That is, suppose that when Washington played Stanford on a particular day, Stanford won. Under this strong hypothesis, had Washington played Cal that day instead of Stanford, Cal would have won.
A weaker version of the hypothesis is that the outcome of Stanford's games is determined by independent draws from a 0-1 box that has a fraction pC of tickets labeled "1" (Stanford wins the game if the ticket drawn is labeled "1"), that the outcome of Berkeley's games is determined similarly, by independent draws from a 0-1 box with a fraction pS of tickets labeled "1," and that pS = pC. This model has some shortcomings. (For instance, when Berkeley and Stanford play each other, the independence assumption breaks down, and the fraction of tickets labeled "1" would need to be 50%. Also, it seems unreasonable to think that the chance of winning does not depend on the opponent. We could refine the model, but that would require knowing more details about who played whom, and the outcome.)
Nonetheless, this model does shed some light on how surprising the records would be if the teams were, in some sense, equally skilled. This box model version allows us to use Fisher's Exact test for independent samples, considering "treatment" to be playing against Stanford, and "control" to be playing against Cal, and conditioning on the total number of wins by both teams (26).
Q1) On the assumption that the null hypothesis is true, the bootstrap estimate of the standard error of the sample percentage of games won by Stanford is ?
Q2) On the assumption that the null hypothesis is true, the bootstrap estimate of the standard error of the sample percentage of games won by Cal is ?
Q3) The approximate P-value for z test against the two-sided alternative that the Stanford and Berkeley teams have different skills is ?
Note :*The z-score for the difference in sample percentages is 2.97685*
In: Statistics and Probability