On Mon, 26 Jun 2006 10:47:58 -0700, [EMAIL PROTECTED] wrote: > whats the difference between raw input and input?
'input' is used to ask the user to input a python expression, which is then run, and 'input' returns the result of executing that expression. For example: (define a function which prints something out) >>> def func(): ... print "You're calling a function" ... return "Function result" ... (now, call input) >>> res = input('Type python here: ') (python outputs the prompt ) Type python here: (and, if you type the python code to call a function after the prompt) Type python here: func() (then python calls the function, which prints out) You're calling a function (meanwhile, the result of calling the function gets assigned to 'res') >>> print res Function result 'raw_input' just returns whatever text the user typed in. That's what you want to use here. 'raw_input' returns a string, which you'll need to convert to a number with the 'int' function, like so: text = raw_input('Type in a number: ') number = int(text) -- http://mail.python.org/mailman/listinfo/python-list