I'm trying to write a function that receives a string and then each character should be sorted by its Unicode value. I cannot get this straight in my head. I first created an empty dictionary and an empty list. I want to first get the word separated and stored in that list and then use than list's members( which is my separated word )as a key for my dictionary and then sort out the dictionary. any help would be appreciated. I'm stuck in how should I map this, using elements of my list as a value for my dictionary. pardon me for beginner's mistake. so if I give my function "ja" as parameter the list will be the follow
My_list=['j','a']
then I want my dictionary to use the members as key and be like this
word_dic={'j':1 , 'a':2}
I used arbitrary values for j and values. their real value is their unicode values
word_dic={}
My_List=[]
def strsort(word):
for i in range(len(word)):
My_List.append(word[i])
for k,v in word_dic.items():
word_dic[My_List[i]] =ord(i)