Shortest code to calculate the Pi number in Python

preview_player
Показать описание
Shortest code to calculate the Pi number
pi = 4*(1 - 1/3 + 1/5 - 1/7 + 1/11 - 1/13 + 1/15 ....)
Рекомендации по теме
Комментарии
Автор

Same thing in one line:
print(f"pi = {4*sum([(-1)**k/(2*k+1) for k in range(10**6)]):.6}")

BooBoo
Автор

total=0
for i in range(10000): total+=1/(((i*2)+1)**6)
print((total*960)**(1/6))

creativecraft_mc
join shbcf.ru