Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. file = open ('file.txt', 'r')
  2. arr = []
  3. l=0
  4. f = file.readline()
  5. while f:
  6.     templist = f.split()
  7.     name = templist[0] + ' ' + templist[1]
  8.     birthday = templist[2]
  9.     passday = templist[3]
  10.     stat = templist[4] + ' | ' + templist[5] + ' | ' + templist[6]
  11.     average = (int(templist[4]) + int(templist[5]) + int(templist[6]))/3.0
  12.     arr.append([name, birthday, passday, stat, average])
  13.     f = file.readline()
  14.     l+=1
  15. arr.sort(key = lambda l: l[2].split('.')[2]+l[2].split('.')[1]+l[2].split('.')[0], reverse=1)
  16. for i in arr:
  17.     print("%10s | %3s | %3s | %10s -> %5f" % (i[0], i[1], i[2], i[3], i[4]))
  18. file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement