Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- class Punto:
- x = 0
- y = 0
- punto_base = Punto()
- punto_base.x = int(input("X: "))
- punto_base.y = int(input("Y: "))
- elenco_punti = []
- numero_punti = int(input("Numero punti: "))
- for p in range(numero_punti):
- punto_corrente = Punto()
- punto_corrente.x = int(input("X: "))
- punto_corrente.y = int(input("Y: "))
- elenco_punti.append(punto_corrente)
- segno_x1 = math.copysign(1, punto_base.x)
- segno_y1 = math.copysign(1, punto_base.y)
- stesso_quadrante = []
- for p in elenco_punti:
- segno_x = math.copysign(1, p.x)
- segno_y = math.copysign(1, p.y)
- if(segno_x == segno_x1 and segno_y == segno_y1):
- stesso_quadrante.append(p)
- for punto in stesso_quadrante:
- print(punto.x, punto.y)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement