[Tutor] how to accept an integer?

2007-12-05 Thread Mahesh N
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

Re: [Tutor] how to accept an integer?

2007-12-05 Thread Kent Johnson
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

Re: [Tutor] how to accept an integer?

2007-12-05 Thread Eric Brunson
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

Re: [Tutor] how to accept an integer?

2007-12-05 Thread Mahesh N
On Dec 6, 2007 2:31 AM, Mahesh N [EMAIL PROTECTED] 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

Re: [Tutor] how to accept an integer?

2007-12-05 Thread Mahesh N
On Dec 6, 2007 2:37 AM, Eric Brunson [EMAIL PROTECTED] 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

Re: [Tutor] how to accept an integer?

2007-12-05 Thread Jerry Hill
On Dec 5, 2007 4:01 PM, Mahesh N [EMAIL PROTECTED] 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

Re: [Tutor] how to accept an integer?

2007-12-05 Thread Kent Johnson
Bryan Fodness wrote: speed = int(raw_input(prompt)) Is this how ALL known integers should be input? Yes, with probably a try/except block and a while loop around it to handle invalid input. There are two good reasons for doing this instead of using input: - it guarantees that the

Re: [Tutor] how to accept an integer?

2007-12-05 Thread Jerry Hill
On Dec 5, 2007 4:46 PM, Bryan Fodness [EMAIL PROTECTED] wrote: On Dec 5, 2007 4:16 PM, Jerry Hill [EMAIL PROTECTED] wrote: speed = int(raw_input(prompt)) Is this how ALL known integers should be input? I don't think I understand the question. If you are prompting your user to enter an

Re: [Tutor] how to accept an integer?

2007-12-05 Thread Alan Gauld
Mahesh N [EMAIL PROTECTED] wrote 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

Re: [Tutor] how to accept an integer?

2007-12-05 Thread Alan Gauld
Mahesh N [EMAIL PROTECTED] wrote More over i find python to be a little sluggish after having worked with C and Java. If you translate C or Java code into python you will usually get a less than optimal implementation. Python should be barely slower than Java and often faster. Compared to C

Re: [Tutor] how to accept an integer?

2007-12-05 Thread Bryan Fodness
On Dec 5, 2007 4:16 PM, Jerry Hill [EMAIL PROTECTED] wrote: On Dec 5, 2007 4:01 PM, Mahesh N [EMAIL PROTECTED] 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