Hello. What are some ways that one can work with (x,y) coordinate pairs in Python? I'm doing a homework assignment that requires me to create a program that can check for certain binary relations (reflexive, transitive, symmetric), and I'm having an issue coming up with the best approach for it. I'm trying to use lists, but coming up with the best logic to work with them is the big issue here. Here's the code I have so far:
x =  y =  def get_relation(): choice = "YES" while (choice.upper() != "NO"): x-coord = int(input("Enter the x-coordinate: ")) y-coord = int(input("Enter the x-coordinate: ")) x.append(x-coord) y.append(y-coord) choice = input("Would you like to enter another coordinate?: ") def IsReflexive(): reflex_x=  reflex_y=  for i in range(len(x)): if (i+1 < len(x)): if (x[i+1] != x[i]): reflex_x.append(x[i]) for i in range(len(reflex_x)): reflex_y(reflex_x[i]) for i in range (len(x)): if (reflex_x[i] ==
The main issue I'm having is that, in the reflexive function I'm building, I'm not sure how to go about making sure that I only get reflexive coordinates in the form (a,a), i.e., (1,1), (2,2), and not have the program give me issues with always saying something is reflexive due to the way I'm performing the searches. Is there a more efficient way to do this that isn't so intensive on the logic? I wanted to try my hand at dictionaries, but I don't want to assume that there are no duplicate pairs (the assignment didn't specify, so I don't want to get tripped up on that). I'm more than likely also gonna experience the same issue with the search logic for the other two functions. What can I do?