One of the challenges on w3resources is to print pi to \'n\' decimal places. Here is my code:
from math import pi
fraser = str(pi)
length_of_pi = []
numbe
As this question already has useful answers, I would just like to share how i created a program for the same purpose, which is very similar to the one in the question.
from math import pi
i = int(input("Enter the number of decimal places: "))
h = 0
b = list()
for x in str(pi):
h += 1
b.append(x)
if h == i+2:
break
h = ''.join(b)
print(h)
Thanks for Reading.