Newbie questions
jim roush
jar at mminternet.com
Tue Jun 13 14:53:19 EDT 2000
On 13 Jun 2000 08:48:48 -0400, Alex <cut_me_out at hotmail.com> wrote:
>
>> 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, pi is a variable.
>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. :)
I'm aware of that but I'm following a set of exercises from a book as
a means to learn Python.
jar at mminternet.com
James A Roush
More information about the Python-list
mailing list