+ 3
need help!
Hi! can someone please tell me why when this code is ran it returns "no output" . thnkz! https://code.sololearn.com/c1nAF8fOaxIg/#py
7 Respostas
+ 16
The result is not printed. Try to use print function on the last statement.
+ 3
output??
I mean print ()MAAB 😊👍
+ 2
thank you both 李立威 and Igor Makarsky
+ 2
looks like you got it working now
+ 1
#Edit (1) add print at the last line
# (2) modify the distance formula
class Dist():
def __init__(self,a,b):
self.a = a
self.b = b
def distance(self):
x1,y1 = self.a
x2,y2 = self.b
return (((x2-x1)**2) + ((y1-y2)**2))**0.5
point1 = (2,2)
point2 = (2,-4)
calc = Dist(point1, point2)
print(calc.distance())
+ 1
thnks Daljeet Singh
0
MAAB What??U know advanced things like class and return but u dont know print?What a ...just happen? lol