My Code :
answer = round((math.pi),precision)
precision=raw_input('Enter number of digits you want after decimal:')
If you use
repr in your print you'll have 15 digits: 3.141592653589793.
If you want more digits (until 50) use
nb_digits = 40 print(format(math.pi, '.%dg' % nb_digits))
(thanks Stefan for the precision :) but as he stated again: don't trust digits after digit 15 so the 1000 digit program is the best).
For even more digits, compute pi yourself just like here: