[Tutor] What is wrong my code?

Hoffmann oasf2004 at yahoo.com
Fri Mar 24 22:02:45 CET 2006


Hello:

Could anyone, please, let me know what is wrong with
my code (shown below)? I am getting a runtime error.
Thanks!
Hoffmann
ps: The code:

#!/usr/bin/python

import math

print '''This program calculates the lenght of the
hypotenuse of a right triangle
    given the lenghts of the two legs as
parameters.\n'''
    
leg1 = raw_input('Enter the first leg of the triangle:
')
leg2 = raw_input('Enter the second leg of the
triangle: ')

result = hypotenuse(leg1, leg2)

print 'The hypotenuse of the triangle is', result
    
def hypotenuse(x,  y):
    result = math.sqrt(x**2 + y**2)
    return result

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Tutor mailing list