Question: Write a program (stored in the file collision.py) that does the following: Reads in data from the file points1.txt and adds all data into a

Write a program (stored in the file collision.py) that does the following:

Write a program (stored in the file collision.py) that does the following:

Reads in data from the file points1.txt and adds all data into

Reads in data from the file points1.txt and adds all data into a Pointset. (Please use 10 rows and 10 columns for your pointset.) Each line contains the y, and feature values for one entry. Reads in data from the file points2.txt, with the same format as points1.txt. (How you want to process/store points2.txt, in a Pointset or otherwise, is up to you.) For each point in points2.txt, determines if there is a point in points 1.txt that occupies the same x, y coordinates (i.e., a 'collision). For each collision print a message on a single line, using the following structure: collision x 4 y 18 where 4 would be the x value of the collision, 18 would be the yvalue of the collision, and there is a single space separating each element after the colon. One line is printed per collision; if there are multiple collisions they should printed be in the same order as encountered in the file points2.txt. If there are no collisions in the file, then a single message should be printed: No collisions

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!