### Thread: Area of circle function is throwing up errors.

1. No Profile Picture
Registered User
Devshed Newbie (0 - 499 posts)

Join Date
Aug 2012
Posts
2
Rep Power
0

#### Area of circle function is throwing up errors.

Hey I am a newbie trying to teach myself how to code. Please forgive me if this is a simple fix.

So I am having trouble with a set of three functions. The first two are meant to calculate distance, and area. These two, without being in a composition, work fine on their own. I have gotten correct results. The last one uses the other two to calculate area of a circle. Here is the code and the track back.

Thanks for any help.

Code:
`def area('radius'): temp=radius**2*3.14159 print temp def distance(x1,y1,x2,y2): distx=x2-x1 disty=y2-y1 distxy=distx**2+disty**2 dist=distxy**0.5 print dist def area2(xc,yc,xp,yp): a2=area(distance(xc,yc,xp,yp)) print a2 area2(5,6,8,10)`
Here is the trackback
Code:
`Traceback (most recent call last): File "C:/Python27/UserScripts/Ch5/area-distance-circlearea.py", line 17, in <module> area2(5,6,8,10) File "C:/Python27/UserScripts/Ch5/area-distance-circlearea.py", line 13, in area2 a2=area(distance(xc,yc,xp,yp)) File "C:/Python27/UserScripts/Ch5/area-distance-circlearea.py", line 2, in area temp=radius**2*3.14159 TypeError: unsupported operand type(s) for ** or pow(): 'NoneType' and 'int'`
2. No Profile Picture
Registered User
Devshed Newbie (0 - 499 posts)

Join Date
Aug 2012
Posts
2
Rep Power
0

#### debugged.

Hey sorry. I debugged the code. Evidently I forgot the return statements. X.x I hope I will be able to glean some knowledge from you folks in the future. Thanks.