+ 1
do you help me to find problem?
help me to run this code.there is a problem i cannot find.thanks advance for help me. #formula def point_distance(x0,y0,x1,y1): distance=((((x1-x0)**2)+((y1-y0)**2))**0.5) return(distance) def triangle_area(x0,y0,x1,y1,x2,y2): a=point_distance(x0,y0,x1,y1) b=point_distance(x0,y0,x2,y2) c=point_distance(x2,y2,x1,y1) s=(a+b+c)/2 return ((s*(s-a)(s-b)(s-c))) ######### #test def test(x0,y0,x1,y1,x2,y2): print("the area of triangle with vertices "+"("+str(x0)+","+str(y0)+")"+"("+str(x1)+","+str(y1)+")"+"("+str(x2)+","+str(y2)+")"+" is "+str(triangle_area(x0,y0,x1,y1,x2,y2))) test(0,0,3,4,1,1) test(-2, 4, 1, 6, 2, 1) test(10, 0, 0, 0, 0, 10)
15 Answers
+ 1
change return in triangle_area
return ((s*(s-a)*(s-b)*(s-c))**0.5)
+ 1
Done...but my problem is not solved😔 [][]
https://code.sololearn.com/cq7R65OkY87d/?ref=app
+ 1
Md.Ruhan Chowdhury
Change this
return ((s*(s-a)*(s-b)*(s-c))**0.5))
+ 1
Md.Ruhan Chowdhury
#formula
def point_distance(x0,y0,x1,y1):
distance=((((x1-x0)**2)+((y1-y0)**2))**0.5)
return(distance)
def triangle_area(x0,y0,x1,y1,x2,y2):
a=point_distance(x0,y0,x1,y1)
b=point_distance(x0,y0,x2,y2)
c=point_distance(x2,y2,x1,y1)
s=(a+b+c)/2
return ((s*(s-a)*(s-b)*(s-c))**0.5)
#########
#test
def test(x0,y0,x1,y1,x2,y2):
print("the area of triangle with vertices "+"("+str(x0)+","+str(y0)+")"+"("+str(x1)+","+str(y1)+")"+"("+str(x2)+","+str(y2)+")"+" is "+str(triangle_area(x0,y0,x1,y1,x2,y2)))
test(0,0,3,4,1,1)
test(-2, 4, 1, 6, 2, 1)
test(10, 0, 0, 0, 0, 10)
+ 1
you didn't add * between brackets
+ 1
Oyelola Pamilerin Kabir sorry.I know c++ and python but not java.You started to learn Java and that's not my side.
Feel free always if need any help😊.
But never say anyone for their private info like number,password or anything private issues.Thats the violation of rules & regulations of sololearn and may banned your account from authority.
Feel free and share your thoughts.😊😊😊
0
Mohan 333 done already.see my last comment
0
it works for me, i just changed return
https://code.sololearn.com/c32vzNJpM86N/?ref=app
0
0
Oyelola Pamilerin Kabir you are a beginner.So learn first.Then work.😊
0
that what i want you to help me out with
0
i want you to teach me how to learn here
0
Alright thanks
- 2
i want to work with you