Mid2 22nd_String_Word_Lengths

 string="i am ubed"

s=string.split()
print(s)
dic={}
for i in s:
    dic[i]=len(i)
print(dic)
#output:
['i', 'am', 'ubed'] {'i': 1, 'am': 2, 'ubed': 4}

Comments

Popular posts from this blog

JAVA Lab Programs

HANGMAN GAME

WD 22. StylingLinks&Buttons