Advertisement
Guest User

Untitled

a guest
Mar 29th, 2020
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. def high(x):
  2.     rankList = []
  3.     result = []
  4.     rank = 0
  5.     high = 0
  6.     lst = x.split()
  7.     for word in lst:
  8.         for char in word:
  9.             #print([char, ord(char) -96])
  10.             rank += ord(char)-96
  11.         rankList.append([rank, word])
  12.         rank = 0;
  13.     for i in range(len(rankList)):
  14.         if(rankList[i][0] > high):
  15.               high = rankList[i][0]
  16.     for k in range(len(rankList)):
  17.         if(rankList[k][0] == high):
  18.             result.append([rankList[k][0],rankList[k][1]])
  19.     print(result)
  20.     return result[0][1]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement