I have a list of distances associated with each compass bearing from 1 to 360 degrees, also stored as a list. I would like to condense the list so as to give ranges of bearings over which the distance is associated, e.g.
From:
bearings = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
distance = [5, 10, 15, 15, 15, 20, 20, 10, 10, 5]
To:
bearings = [1, 2, 3-5, 6-7, 8-9, 10]
distance = [5, 10, 15, 20, 10, 5]
Any ideas what sort of approach to take this on with? Thanks in advance!