[Tutor] Problem with exponents and square roots
Sean 'Shaleh' Perry
shalehperry@attbi.com
Fri, 29 Mar 2002 21:50:46 -0800 (PST)
On 29-Mar-2002 James M Lang wrote:
> 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'
>
the answer is right there "unsupport type". raw_input returns a string, not a
number.
num_a = float(a)
num_b = float(b)
c = (a**2 + b**2)
c = c**.5