Answer:
The solution code is written in Python
- def max(a, b):
- if(a > b):
- return a
- else:
- return b
-
- num1 = int(input("Please input the first number: "))
- num2 = int(input("Please input the second number: "))
-
- print(max(num1, num2))
Explanation:
Firstly create a function max that accepts two input, a and b, as required by question (Line 1). In the function, create if statement to check if a greater than b return a and vice versa (Line 2 -5).
In the main program (Line 7 - 10), prompt user to input two numbers (Line 7 - 8). At last call the function by passing num1 and num2 as arguments and print the result (Line 10).
<span>Fire extinguishers should be stored in a
boat at the engine area and near the operator. A fire extinguisher should be
put near the engine because the engine of the boat is a fire hazardous place
and this is the area where a fire could start.
The fire extinguisher should be installed properly using a mounting
bracket to hold the extinguisher in place. There are different types of
extinguishers that should be installed in the boat, these are type A, B, and C
extinguishers. Type A extinguishers can turn off the fire caused by combustible
solids like wood and paper. Type B extinguishers can turn off fire caused by
gasolines, oil, and greases. While Type C extinguishers can turn off fire
caused by an electrical problem.</span>
Answer:
import numpy as np
import matplotlib.pyplot as plt
def calculate_pi(x,y):
points_in_circle=0
for i in range(len(x)):
if np.sqrt(x[i]**2+y[i]**2)<=1:
points_in_circle+=1
pi_value=4*points_in_circle/len(x)
return pi_value
length=np.power(10,6)
x=np.random.rand(length)
y=np.random.rand(length)
pi=np.zeros(7)
sample_size=np.zeros(7)
for i in range(len(pi)):
xs=x[:np.power(10,i)]
ys=y[:np.power(10,i)]
sample_size[i]=len(xs)
pi_value=calculate_pi(xs,ys)
pi[i]=pi_value
print("The value of pi at different sample size is")
print(pi)
plt.plot(sample_size,np.abs(pi-np.pi))
plt.xscale('log')
plt.yscale('log')
plt.xlabel('sample size')
plt.ylabel('absolute error')
plt.title('Error Vs Sample Size')
plt.show()
Explanation:
The python program gets the sample size of circles and the areas and returns a plot of one against the other as a line plot. The numpy package is used to mathematically create the circle samples as a series of random numbers while matplotlib's pyplot is used to plot for the visual statistics of the features of the samples.
Answer:
tech A only
Explanation:
Technician A is right because a cracked exhaust manifold allows more oxygen into the exhaust stream, which affects oxygen sensor voltage. Technician B is wrong because a clogged air filter raises Hydrocarbons (HC) and also affects O2 (Oxygen) and CO (Carbon Monoxide) levels.
C stay away from his or her vechicle