Newbie questions
Michael Hudson
mwh21 at cam.ac.uk
Tue Jun 13 08:54:08 EDT 2000
Alex <cut_me_out at hotmail.com> writes:
> > pi = 3.141592654
> > radius = input("Enter is the radius: ")
> > circ = 2 * pi * radius
> > print circ
>
> Perhaps the third line should be 'circ = 2 * pi * float (radius)'
>
> As it is, you are multiplying a float by a string, I think. That should
> be giving you a type error.
No, he's used "input", which evaluates what you type (and hence the
usual security related hackles rise).
> By the way, you can get pi from the math module:
> import math
> print math.pi
>
> It's good not to have constants encoded directly in to your program, in
> case they ever change. :)
That was the DEC Fortran manual, wasn't it?
faaar-to-young-to-have-seen-*that*-one-ly y'rs
Michael
--
The ability to quote is a serviceable substitute for wit.
-- W. Somerset Maugham
More information about the Python-list
mailing list