Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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:
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started