[Tutor] Miles Per Gallon Calculator`

bob gailer bgailer at gmail.com
Thu Sep 18 17:23:52 CEST 2008


iannaconec at optonline.net 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?
> If this is correct why do I get an error regarding the division of two 
> strings if i type print " < variable> " / < variable>

Please make life easier for all of us by posting real code and real 
error messages. For example:

 >>> a = "cat"
 >>> b = 1
 >>> print a/b
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
TypeError: unsupported operand type(s) for /: 'str' and 'int'


-- 
Bob Gailer
Chapel Hill NC 
919-636-4239

When we take the time to be aware of our feelings and 
needs we have more satisfying interatctions with others.

Nonviolent Communication provides tools for this awareness.

As a coach and trainer I can assist you in learning this process.

What is YOUR biggest relationship challenge?



More information about the Tutor mailing list