1000 digits of pi in Python

前端 未结 11 1452
忘了有多久
忘了有多久 2020-11-28 10:54

I have been thinking about this issue and I can\'t figure it out. Perhaps you can assist me. The problem is my code isn\'t working to output 1000 digits of pi in the Python

11条回答
  •  难免孤独
    2020-11-28 11:23

    I'm not familiar with your algorithm. Is it an implementation of BBP?

    In any case, your make_pi is a generator. Try using it in a for loop:

    for digit in make_pi():
        print digit
    

    Note that this loop is infinite: make_pi() never throws StopIteration

提交回复
热议问题