Answer:
- Local fisherman recover the body of Major Martin off the coast of Spain
.
- Spanish officials pass off the information in the briefcase to German agents.
- Major Martin's name appears on a casualty list in a British newspaper.
- Germany prepares for an imminent attack on the island of Sardinia.
Explanation:
This above is the order in which Operation Mincemeat was executed in WW2 to deceive the Germans into believing that the Allies were going to invade the Balkans directly instead of Sicily which was their actual target.
The plan involved a fictitious Major Martin who had secret documents about the Allied invasion of the Balkans. After the body was released from a British submarine, it washed up in Spain where it was found by local fishermen.
Spanish officials then passed the information in the briefcase Major Martin had to German intelligence. To further reinforce the ruse, the British published Major Martin's name in a casualty list.
The Germans were thoroughly convinced and switched forces from Sicily for the defence of the Balkans and the island of Sicily.
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:
for ( initialization; condition;increment)
{
code goes here;
}
in python:
for i in list/range:
code with proper indentation
By initialization above we mean, like int i=0; etc.
By condition like i<10;
and by increment it means like i++, ++i or i+=1; etc
And in python, i can be an integer value if the range is mentioned, and it can be an item of a list if the list is used. We can also use an array, string and various other data structures in python. like we can have characters in a string and so on.
Explanation:
Please check the answer section.