Python: I\'m not sure how to further organize a list I\'ve created. For this pro
ID: 3592722 • Letter: P
Question
Python: I'm not sure how to further organize a list I've created.
For this program, I am to draw the path of hurricane irma using coordinates and wind speed found within a .csv file. With the code I provided below, I've managed to filter out the data to just the coordinates and wind speed as shown here:
>>>print(lines)
[['16.4', '-30.3', '50'], ['16.4', '-31.2', '60'], ['16.4', '-32.2', '65']............
However, I need a way to further organize my list of 'lines' so that the first number of each set represents the x-value (latitude), the second number the y-value (longitude), and the third wind speed (not of much concern yet but I will need later on so it should be organized as well).
I'm not sure how to further chunk this list into usable coordinates and wind speed for which I could animate the path of the hurricane. Below is the code I have so far:
Please help!
Explanation / Answer
coordinates = [] for x in range(11): for y in range(11): coordinates.append((x, y)) coordinate = [] x = 0 y = 0 while y < 10: while x < 10: coordinate.append((x,y)) x += 1 coordinate.append((x,y)) y += 1 print(coordinate)Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.