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
This is what I did, really elementary but works (max 15 decimal places):
pi = 22/7
while True:
n = int(input('Please enter how many decimals you want to print: '))
if n<=15:
print('The output with {} decimal places is: '.format(n))
x = str(pi)
print(x[0:n+2])
break
else:
print('Please enter a number between 0 and 15')