0

PROBLEM

I am not get full dict. Mohammad Umair: set1={1,2,3,4,5} list1=["one","two","three","four","five"] dict1={} i=0 for k in set1: dict1.update(k=list1[i]) i=i+1 print(dict1)

2nd Jul 2018, 6:29 PM
Mohammad Umair
Mohammad Umair - avatar
10 Respostas
+ 6
Update changes the entry if it is in the dictionary so each call "k" is changed leaving just the last item.
2nd Jul 2018, 6:41 PM
John Wells
John Wells - avatar
+ 3
set1={1,2,3,4,5} list1=["one","two","three","four","five"] dict1={} i=0 for k in set1: dict1[k]=list1[i] i=i+1 print(dict1)
2nd Jul 2018, 6:41 PM
ifl
ifl - avatar
2nd Jul 2018, 6:49 PM
ifl
ifl - avatar
+ 1
what version of python do you have... can you print a simple hello world?
2nd Jul 2018, 6:53 PM
ifl
ifl - avatar
0
ifl it not give output
2nd Jul 2018, 6:45 PM
Mohammad Umair
Mohammad Umair - avatar
0
ifl it not give output
2nd Jul 2018, 6:45 PM
Mohammad Umair
Mohammad Umair - avatar
0
but in my laptop it not work...
2nd Jul 2018, 6:52 PM
Mohammad Umair
Mohammad Umair - avatar
0
thx
2nd Jul 2018, 6:54 PM
Mohammad Umair
Mohammad Umair - avatar
0
its work..
2nd Jul 2018, 6:54 PM
Mohammad Umair
Mohammad Umair - avatar
0
thx
2nd Jul 2018, 6:54 PM
Mohammad Umair
Mohammad Umair - avatar