Last active
January 17, 2021 10:42
-
-
Save tanviredu/6c47a3c89a7afa7e2447d9356e63b3b1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = ["eat","tea","tan","ate","nat","bat"] | |
print("INPUT : ",data) | |
def find_ord_sum(string): | |
res = [] | |
for item in list(string): | |
res.append(ord(item)) | |
return sum(res) | |
orw = [] | |
for item in data: | |
orw.append(find_ord_sum(item)) | |
key = list(set(orw)) | |
r = [] | |
for item in key: | |
b=[] | |
for i in range(len(orw)): | |
if item == orw[i]: | |
b.append(data[i]) | |
r.append(b) | |
print("OUTPUT : ",r) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment