[Tutor] how to accept an integer?

Mahesh N mahesh.mach at gmail.com
Wed Dec 5 22:33:09 CET 2007


On Dec 6, 2007 2:31 AM, Mahesh N <mahesh.mach at gmail.com> 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?
>
> >>> 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
>
>
>
>
absolutely, i went up the shell and found out that i had declared a variable
named input and it was shadowing the input() function. i restarted the shell
and now everything's fine.
Thanks Everyone.




-- 
The Place where I Come from,
We Face our Enemies,
If our enemy is Unarmed,
We Offer our SWORD!!!


Courtesy "Warrior Within"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20071206/c19634b8/attachment.htm 


More information about the Tutor mailing list