Advertisement
informaticage

Categorizzare punti in quadranti

Feb 10th, 2021
778
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. numero_punti = int(input("Numero punti: "))
  2.  
  3. primo = []
  4. secondo = []
  5. terzo = []
  6. quarto = []
  7.  
  8. for punto in range(numero_punti):
  9.   x = int(input("x: "))
  10.   y = int(input("y: "))
  11.  
  12.   if(y >= 0 and x >= 0):
  13.     primo.append((x,y))
  14.  
  15.   if(y >= 0 and x < 0):
  16.     secondo.append((x,y))
  17.  
  18.   if(y < 0 and x < 0):
  19.     terzo.append((x,y))
  20.  
  21.   if(y < 0 and x >= 0):
  22.     quarto.append((x,y))
  23.  
  24. print("Primo ", primo)
  25. print("Secondo ", secondo)
  26. print("Terzo ", terzo)
  27. print("Quarto ", quarto)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement