[Tutor] how to accept an integer?

Mahesh N mahesh.mach at gmail.com
Wed Dec 5 22:20:06 CET 2007


On Dec 6, 2007 2:37 AM, Eric Brunson <brunson at brunson.com> wrote:

> Mahesh N wrote:
> > I dun understand the mistake. My aim is to accept an integer number.
> > The python lookup in IDLE asks for a string object but the interpreter
> > returns with the following error message. Some one pls explain.
> > Thank You
> >
> > PS : I understand that i can do type conversion after getting input
> > thru raw_input(). But how does input() function work?
>
> Did you read this?
>
> http://docs.python.org/lib/built-in-funcs.html#l2h-40
>
> What do you not understand about it?
>
> >
> > >>> prompt="temme a number\n"
> > >>> speed =input(prompt)
> >
> > Traceback (most recent call last):
> >   File "<pyshell#56>", line 1, in <module>
> >     speed =input(prompt)
> > TypeError: 'str' object is not callable
> > >>> speed =input("temme a number\n")
> >
> > Traceback (most recent call last):
> >   File "<pyshell#57>", line 1, in <module>
> >     speed =input("temme a number\n")
> > TypeError: 'str' object is not callable
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Tutor maillist  -  Tutor at python.org
> > http://mail.python.org/mailman/listinfo/tutor
> >
>
>
sorry i dint go thru the docs. i thought i will delve into it once i felt
comfortable with the language.
is the new line character not allowed in input() statement ???
cuz i tried it without the new line character and it works fine.
More over i find python to be a little sluggish after having worked with C
and Java. But one thing's for sure. Its damn powerful and a lovely language.
can someone temme where python is most applicable?
server side scripting? am i guessing it right?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20071206/92762aa2/attachment.htm 


More information about the Tutor mailing list