Advertisement
Mrbzs

Untitled

Feb 20th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. inputFile = open('a_example.txt', 'r')
  2. bookCount, libCount, days = inputFile.readline().strip().split(' ')
  3. bookScore = inputFile.readline().strip().split(' ')
  4. lines = [line.strip() for line in inputFile.readlines()]
  5. libs = []
  6. libsInfo = []
  7. i = 0
  8. while i < len(lines):
  9. libsInfo.append(lines[i].strip().split(' ')) # books, signup, shipMax
  10. libs.append(lines[i + 1].strip().split(' ')) # Each book
  11. i += 2
  12.  
  13. for j in range(len(libs)):
  14. libs[j].sort(key=lambda x: bookScore[int(x)], reverse=True)
  15.  
  16. print(libs)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement