Error Testing

Mark Lawrence breamoreboy at yahoo.co.uk
Sat Oct 19 09:19:09 EDT 2013


On 19/10/2013 13:57, Roy Smith wrote:
> On 10/19/13 8:23 AM, Scott Novinger wrote:
>>> My goal is to make sure that the value entered for the radius is an integer
>>> value.
>
> In article <mailman.1254.1382186691.18130.python-list at python.org>,
>   Ned Batchelder <ned at nedbatchelder.com> wrote:
>
>> First, radius is the result of input(), so it is
>> always a string, never an int.
>
> input() returns ints or floats for values which can be converted to
> those.  I suspect you're thinking of raw_input()?
>

Really, not what it says here 
http://docs.python.org/3/library/functions.html#input and shown by the 
following?

In [5]: a=input()
12345

In [6]: a
Out[6]: '12345'

In [7]: type(a)
Out[7]: builtins.str

-- 
Roses are red,
Violets are blue,
Most poems rhyme,
But this one doesn't.

Mark Lawrence




More information about the Python-list mailing list