[Tutor] LCM

christopher.henk at allisontransmission.com christopher.henk at allisontransmission.com
Thu Oct 21 02:01:59 CEST 2010


benderjacob44 at gmail.com wrote on 10/20/2010 07:30:32 PM:

> 
> thing = raw_input("What is the first number?\n\n")
> 
> thing2 = raw_input("What is the second number?\n\n")
> 
> int(thing)
> int(thing2)
> 
        The two lines above do the calculation of turning your input 
strings into int's but do not save the value anywhere.
        You want to assign the calculation to a variable (can reuse thing 
and thing2 if you wish) and then use that calculation later on.

<Snip>

> 
> The only problem is that when I tell it that thing3 = x/thing it gives 
> an error. Here it is:
> 
> Traceback (most recent call last):
>    File "C:/Documents and Settings/Family/My Documents/LCM.py", line 10, 

> in <module>
>      thing3 = x/thing
> TypeError: unsupported operand type(s) for /: 'int' and 'str'

the error here is telling you that thing is a string and python cannot 
divide an int by a string.

> 
> Same with thing4...
> 
> Can you please help! Thanks in advance...

I didn't check the rest of the program.  But that should at least get you 
moving along.

Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101020/48ce2057/attachment.html>


More information about the Tutor mailing list