Generation

generate functionWed, 16 Nov 2022

(ncount/n)*4.0を求めよ

def pi(n): ncount = 0 for i in range(n): x = random.random() y = random.random() if x*x + y*y <= 1: ncount = ncount + 1 return (ncount/n) * 4.0

Want to kickstart your project?Use the new AI Studio to create your code