Share your repls and programming experiences

← Back to all posts
100 digits of pi which ones which
Uzalii (423)

This is some simple python code i put together and it tells where about each number of pi is but only for 100 digits enjoy and feel free to use parts of it. Don't forget to Upvote this too.

Comments
hotnewtop
ChezCoder (1606)

5th digit of pi is 5 XD

Uzalii (423)

@ChezCoder lol and did you upvote

ChezCoder (1606)

if you do file reading, you can do more than 1000 digits :)
PUT ALL DIGITS IN ONE LINE

digits_of_pi = open("FILENAME.txt","r").readlines()[0]
Uzalii (423)

@ChezCoder Thx this will be helpful

Dart (1200)

the 63th digit of pi lol 63th cool project though

Dart (1200)

try running a

if 3 in pidig:
    #change th to rd

@Uzalii

Uzalii (423)

@Zexogon Thx man its fixed try it now

sanjay2k19 (2)

Pretty cool! Although I will point out that you get an error if you put in a decimal number...

[deleted]

Really cool. But there are ways to calculate pi. Using this strategy, you can write thousands of digits. Ask me if you want to know more.

ChristoferK (8)

@CodeABC123 Thousands ? Pah! I can write an algorithm that will generate a couple of trillion digits in under 100 iterations. But if you just want to know the value of any particular digit, it's possible to do that such that it takes no additional computer memory or time to obtain the 10-trillionth digit as it does to obtain the 2nd digit.

ChristoferK (8)

Disallowing 1 as a choice doesn't make sense: the first digit of π is 3; there is no zeroth digit. Therefore, your selection range should be between 1-100 inclusive.

Uzalii (423)

@ChristoferK 1= . So I had to disallow it as 1 is not a digit

sugarfi (630)

@Uzalii just change pi[pidig] to pi.replace('.', '')[pidig]

Uzalii (423)

@ChristoferK I Changed it it is no 1-100

8D_Joe_Efretuei (76)

How did you get 100 digits of pi

[deleted]

pi does not = 3.14...067. It irrational

Uzalii (423)

@Thecrowbar1234 I shortened it to the first 100 digits this number is not really pi just a very small version of pi