Advertisement
informaticage

Classi per punti 3d

Feb 10th, 2021
799
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. class Point3d:
  2.   x = 0
  3.   y = 0
  4.   z = 0
  5.  
  6.   def __init__(self, x, y, z):
  7.     self.x = x
  8.     self.y = y
  9.     self.z = z
  10.  
  11.   def __repr__(self):
  12.     return "(%d,%d,%d)" % (self.x, self.y, self.z)
  13.  
  14. elenco_punti = []
  15.  
  16. numero_punti = int(input("N punti: "))
  17.  
  18. for p in range(numero_punti):
  19.   x = int(input("x: "))
  20.   y = int(input("y: "))
  21.   z = int(input("z: "))
  22.   punto_letto = Point3d(x,y,z)
  23.  
  24.   elenco_punti.append(punto_letto)
  25.  
  26. print(elenco_punti)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement