How do i calculate the area of a circle?
So, i'm programming in python 2.7 version(if the version is important, maybe the solution would be different in python 3 or above). Im doing an excercise that needs me to calculate an area of a circle. The code i have at this moment is something that should lead me to the solution, but i'm encountering all sorts of errors. The code goes like this import math def distance(x1, y1, x2, y2): dx=x2-x1 dy=y2-y1 dsquared=dx**2+dy**2 result math.sqrt(dsquared) return result #this part is good and provides needed stuff, the stuff you are about to see, gives me all sorts of problems. radius=distance(xc, yc, xp, yp) result=area(radius) return result #and this should be the last part def area2(xc, yc, xp, yp): radius=distance(xc, yc, xp, yp) result=area(radius) return result I should also mention that i'm a terrible mathematician, so there could potentially be some errors in the maths stuff itself. I appreciate any help.