[Tutor] Count for loops
Alan Gauld
alan.gauld at yahoo.co.uk
Tue Apr 11 16:32:37 EDT 2017
On 11/04/17 17:48, Rafael Knuth wrote:
> Pi_Number = str(3.14159265358979323846264338327950288419716939)
> Pi_Number = "3" + Pi_Number[2:]
> print(Pi_Number)
> 3141592653589793
>>>>
>
> How come that not the entire string is being printed, but only the
> first 16 digits?
There are two problems here.
First str() truncates the length of the output to make it look nicer.
Second your version of PI has too many decimal places for a floating
point to hold. Flosting point numbers can hold a huge range of numbers
but not a huge precision.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list