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 input_number() > > for the moment. > > > > ####################################################### > > def input_number(prompt): > > """Reads an integer from the next line of input.""" > > while 1: > > x = raw_input(prompt) > > if x.isdigit(): > > return int(x) > > else: > > print 'Boo' > > ####################################################### [...] > > I added one more behavior so that input_number continues to ask until it's > > satisified by a number. Hope this helps! > > Yes, it really helps a lot. Now I can proceed with my script!! [...]
Another newbe question! I use "while True: " to evaluate an expression, I see that you used while 1: .. what's the diffrence if any?! -- Panagiotis _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
