Oct-28-2018, 10:31 AM
I'm writing a code for return the formula of a circle by giving the coordinates of the O and the radius
this is a part of my code
the func()return the formula of the circle.But it return output as a String with (' ')quotes just like
this is a part of my code
class circle:
def __init__(self,o_x,o_y,r):
if(r<0):
raise ArithmeticError("Radious can't be smaller than 0")
self.o_x=float(o_x)
self.o_y=float(o_y)
self.r=float(r)
self.co_x=-2*self.o_x
self.co_y=-2*self.o_y
self.c=(self.o_x)**2+(self.o_y)**2-self.r**2
def func(self):
concat_x="+"
concat_y="+"
concat_c="+"
if(self.co_x<0):
concat_x=""
if(self.co_y<0):
concat_y=""
if(self.c<0):
concat_c=""
func="x**2 " + concat_x + str(self.co_x) + "x " + "+y**2 " + concat_y + str(self.co_y) + "y " + concat_c + str(self.c)+" = 0"
return func the func()return the formula of the circle.But it return output as a String with (' ')quotes just like
Output:'x**2 + 4x + y**2 +6y -15'But I need to return a Standard Output without (' ') just likeOutput:x**2 + 4x + y**2 +6y -15
