[Tutor] hypotenuse

Robert Childers rbtchilders at gmail.com
Fri Mar 14 02:02:16 CET 2008

I am in an early lesson in "A Byte of Python."  Instead of writing a program
to find the area of a rectangle I thought it would be useful to write a
program to determine the length of the diagonal of a "golden rectangle",
which would of course equal the sq root of the sum of the squares of
the width and height.  Here is my program:
>>> height = input ("Height:")
>>> width = input ("Width:")
>>> int = ((height**2) + (width**2))
>>> print int
>>> hypotenuse * hypotenuse = int
SyntaxError: can't assign to operator

I looked ahead in the lesson and could find no mention of square roots.  How
do I find the square root of an integer?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080313/f2d4933c/attachment.htm 

More information about the Tutor mailing list