+ 1
create a dictionary having keys as words in alphabetical order in SENTENCE and values as length of words in the respective keys
create a dictionary having keys as words in alphabetical order in SENTENCE and values as length of words in the respective keys. can anybody help for this problem statement? i wrote code for counting length of string but don't know how make dictionary. list=["buyg","huh","jhjjiows","iojajs"] new_list=[] for item in list: len_list_item =len(item) new_list.append(len_list_item) print(new_list) dic={}
1 Odpowiedź
+ 3
list=["buyg","huh","jhjjiows","iojajs"]
list.sort()
print({i:len(i) for i in list})