[Tutor] Rounding to n significant digits?
Glen Wheeler
gew75 at hotmail.com
Mon Jul 5 03:41:43 EDT 2004
Hey, it worked for me. Gregor; you don't mind if I use this code in a
class demonstration? I find it extremely instructive ;).
Glen
----- Original Message -----
From: "Gregor Lingl" <glingl at aon.at>
To: "Python Tutor Mailing List" <tutor at python.org>
Sent: Monday, July 05, 2004 4:16 PM
Subject: Re: [Tutor] Rounding to n significant digits?
>
>
> Gregor Lingl schrieb:
>
> As it happens sometimes the code below got
> corrupted. print statement should appear within the
> body of the for-loop.
>
> Please use the attached code.
> Sorry for the inconvenience.
>
> Gregor
>
> >
> > Later after some correspondence about it we arrived at:
> >
> > import sys
> > for i in range(3):
> > r=''
> > for c in sys.argv[1]:
> > n=int('2l7y202nn6lx6xh0ve',36)//8**(3*int(c)+i)%8;r+=' |_ _ _|
> > |_|'[2*n:2*n+3]
> > print r
> >
>
----------------------------------------------------------------------------
----
> import sys
> for i in range(3):
> r=''
> for c in sys.argv[1]:
> n=int('2l7y202nn6lx6xh0ve',36)//8**(3*int(c)+i)%8;r+=' |_ _ _|
|_|'[2*n:2*n+3]
> print r
>
----------------------------------------------------------------------------
----
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list