Re: [Tutor] Input checking [letters or numbers]

2005-12-24 Thread Alan Gauld
Another newbe question! I use while True: to evaluate an expression, I see that you used while 1: .. what's the diffrence if any?! Python only provided boolean literal values (True, False) relatively recently. Long time Python programmers, especially those with a C background(*) are used to

[Tutor] Input checking [letters or numbers]

2005-12-23 Thread Panagiotis Atmatzidis
Hello, Can someone provide me with an error checking example about an x variable that needs to be number only? I used something like: def useridf(): print print WARNING: If you don't understand why this must be unique, exit and read the manual. print userid = input(x : )

Re: [Tutor] Input checking [letters or numbers]

2005-12-23 Thread bob
At 10:15 AM 12/23/2005, Panagiotis Atmatzidis wrote: Hello, Can someone provide me with an error checking example about an x variable that needs to be number only? I used something like: def useridf(): print print WARNING: If you don't understand why this must be unique, exit and

Re: [Tutor] Input checking [letters or numbers]

2005-12-23 Thread Panagiotis Atmatzidis
Hello there, Thank you for the prompt response. On 12/23/05, bob [EMAIL PROTECTED] wrote: At 10:15 AM 12/23/2005, Panagiotis Atmatzidis wrote: Hello, Can someone provide me with an error checking example about an x variable that needs to be number only? I used something like: def

Re: [Tutor] Input checking [letters or numbers]

2005-12-23 Thread Danny Yoo
x = raw_input(x : ) if x.isdigit(): # ensure input is a number y = int(x) # convert to integer else: print 'Boo Hello Bob and Panagiotis, It might be good to make this number-reading thing a function, just to make it easier to reuse (and test!) it. Let's call this input_number() for

Re: [Tutor] Input checking [letters or numbers]

2005-12-23 Thread Panagiotis Atmatzidis
Hello Dany :-) On 12/23/05, Danny Yoo [EMAIL PROTECTED] wrote: x = raw_input(x : ) if x.isdigit(): # ensure input is a number y = int(x) # convert to integer else: print 'Boo Hello Bob and Panagiotis, It might be good to make this number-reading thing a function, just to

Re: [Tutor] Input checking [letters or numbers]

2005-12-23 Thread Panagiotis Atmatzidis
Yeah works you're right. :-) On 12/23/05, bob [EMAIL PROTECTED] wrote: At 11:16 AM 12/23/2005, Panagiotis Atmatzidis wrote: Hello there, Thank you for the prompt response. On 12/23/05, bob [EMAIL PROTECTED] wrote: [snip] print input(x ; ) and enter Hello world x = input(x: )

Re: [Tutor] Input checking [letters or numbers]

2005-12-23 Thread bob
At 11:16 AM 12/23/2005, Panagiotis Atmatzidis wrote: Hello there, Thank you for the prompt response. On 12/23/05, bob [EMAIL PROTECTED] wrote: [snip] print input(x ; ) and enter Hello world x = input(x: ) x: hello world Traceback (most recent call last): File stdin, line 1, in ?

Re: [Tutor] Input checking [letters or numbers]

2005-12-23 Thread Panagiotis Atmatzidis
On 12/23/05, Panagiotis Atmatzidis [EMAIL PROTECTED] wrote: Hello Dany :-) On 12/23/05, Danny Yoo [EMAIL PROTECTED] wrote: [...] Hello Bob and Panagiotis, It might be good to make this number-reading thing a function, just to make it easier to reuse (and test!) it. Let's call this

Re: [Tutor] Input checking [letters or numbers]

2005-12-23 Thread Kent Johnson
Panagiotis Atmatzidis wrote: Hello, Can someone provide me with an error checking example about an x variable that needs to be number only? I used something like: def useridf(): print print WARNING: If you don't understand why this must be unique, exit and read the manual.

Re: [Tutor] Input checking [letters or numbers]

2005-12-23 Thread bob
At 11:28 AM 12/23/2005, Panagiotis Atmatzidis wrote: On 12/23/05, Panagiotis Atmatzidis [EMAIL PROTECTED] wrote: Hello Dany :-) On 12/23/05, Danny Yoo [EMAIL PROTECTED] wrote: [...] Hello Bob and Panagiotis, It might be good to make this number-reading thing a function, just