On Thu, Sep 18, 2008 at 6:14 AM, <[EMAIL PROTECTED]> wrote: > When <variable> = raw_input ( " please enter a number " ) > <variable> = int (<variable>) is run as part of a python script It should > take in the user stored input and store it as an integer. Am I correct. The > string represented by <variable> in memory is now represented by 5 for > example?
Yes > If this is correct why do I get an error regarding the division of two > strings if i type print " < variable> " / < variable> Because " <variable> " is a string and you are dividing it by an integer. For example: In [2]: value = 5 In [3]: "value" / value --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /Users/kent/Documents/Python/Tutor/<ipython console> in <module>() TypeError: unsupported operand type(s) for /: 'str' and 'int' What did you expect to print? Why did you use the / in the print statement? Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor