Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
ipynb#
def __repr__(self):
motif = "Point3D({},{},{})"
return motif.format(self.x, self.y, self.z)
def __abs__(self):
import math
return math.sqrt(self.x**2 + self.y ** 2 + self.z ** 2)
Out[26]: 5.385164807134504
Out[21]: Point3D(2.0,3.0,4.0)
Entrée [35]: p1 - p2
Out[35]: Point3D(-1.0,-2.0,-1.0)
Out[36]: 2.449489742783178
2000-01-01
Out[15]: datetime.date(2000, 1, 1)
Out[17]: '2000-01-01'
Out[41]: [Point3D(1.0,0.0,0.0),
Point3D(-1.0,-1.0,-1.0),
Point3D(1.0,2.0,0.0),
Point3D(10.0,10.0,1.0)]
Out[56]: 1252
def __del__(self):
print(" Objet détruit ")
Entrée [ ]: