Answer:
import numpy as np
def sample_median(n, P):
return np.median( np.random.choice ( np.arange (1, len(P) + 1 ), n, p = P ) )
print(sample_median(10,[0.1 0.2 0.1 0.3 0.1 0.2]))
print(sample_median(10,[0.1 0.2 0.1 0.3 0.1 0.2]))
print(sample_median(5, [0.3,0.7])
print(sample_median(5, [0.3,0.7])
Explanation:
- Bring in the numpy library to use the median function provided by the numpy library.
- Define the sample_median function that takes in 2 parameters and returns the median with the help of built-in random, choice and arrange functions.
- Call the sample_median function by providing some values to test and then display the results.
Output:
4.5
4.0
2.0
1.0
Answer:
All the ports in a hub are in the same collision domain and a hub sends frames from one host to all other hosts in the network. This makes it prone to collision and poor network throughput. Just like a network switch, it uses the CSMA/CD protocol to detect collision in its network.
A network switch reduces its collision domain to just a port and sends frames from one host to another using its mac table as a route. This makes the network very efficient with high throughput. It also uses the CSMA/CD protocol to detect collision
Explanation:
Switches and hubs are used in networking to connect computer devices in a network. A hub is an obsolete device networking that broadcast a frame to all other ports or host in the network except for the send host port. This increases the rate of collision as all the ports in a hub share the same collision domain. A switch is an efficient frame switching device in a network, which uses its MAC table to decide and find a destination host.
CSMA/CD is a collision detection protocol used in a network to detect and prevent a collision. With this protocol, a host is able to listen, wait, send and resend frames to prevent a collision.
Answer:
The function in Python is as follows:
def MaxValue(userNum1, userNum2):
if userNum2>userNum1:
return userNum2
else:
return userNum1
Explanation:
This defines the function
def MaxValue(userNum1, userNum2):
This returns userNum2 if userNum2 is greater than userNum1
<em> if userNum2>userNum1:</em>
<em> return userNum2</em>
If otherwise, this returns userNum1
<em> else:</em>
<em> return userNum1</em>
<em />
B. Metropolitan area network
Answer:
A
Explanation:
After you make a big goal you must make many small goals to reach it