0
def calculate_pi(number_of_drops):

in_circle = 0
in_square = 0

for i in range(number_of_drops):
    x = random.random()
    y = random.random()

    if math.sqrt(x*x+y*y) <= 1:
        in_circle += 1

    in_square += 1

return in_circle / in_square * 4

x が関数の入力であり、y が理想的に matplotlib を使用して関数の戻り出力であるこの関数をプロットするにはどうすればよいですか?

4

1 に答える 1