[Tutor] Problem with exponents and square roots

James M Lang jimmy_130@lycos.com
Fri, 29 Mar 2002 18:48:21 -0500


I followed everyone's instructions for using square roots and exponents and got this.

Traceback (most recent call last):
  File "C:\WINDOWS\Desktop\Jimmy's Folder\Python Source\hypotenuse", line 9, in ?
    c = (a**2+b**2)**.5
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'


Here's the original source

print "Program for solving hypotenuse of right triangle"
a = raw_input("What is the length of A? ")
b = raw_input("What is the length of B? ")
c = (a**2+b**2)**.5
print "The hypotenuse is", c

the question is, of course, why did I get this?


See Dave Matthews Band live or win a signed guitar
http://r.lycos.com/r/bmgfly_mail_dmb/http://win.ipromotions.com/lycos_020201/splash.asp