Anonymous0069

Untitled

Aug 7th, 2025
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | Source Code | 0 0
  1. # Name: Ayaan Kushwah
  2. # Roll No: 250246
  3. # Contact: 9211929151, [email protected]
  4.  
  5.  
  6. import csv
  7.  
  8. file = open(r"C:\Users\DELL 5420\Downloads\Asteroids.csv", 'r', newline = "\r\n")
  9. reader = csv.reader(file)
  10. sun_distance = []
  11. for row in reader:
  12.     sun_distance.append(row)
  13.  
  14. sun_distance.sort(key = lambda x: (x[1]))
  15. length = len(sun_distance)
  16. for i in range (length - 1, length - 12, -1):
  17.     print(sun_distance[i][0] ,",", sun_distance[i][1], ",", sun_distance[i][2] )
  18.  
  19.  
  20.  
  21. file.close()
Advertisement
Add Comment
Please, Sign In to add comment