0

Input values in dictionary in python 3

can anyone help me, for taking a no. of values in dictionary format in python 3 using a loop

17th Sep 2017, 5:38 AM
mukesh kumar rao
mukesh kumar rao - avatar
4 ответов
+ 6
Sure, but what will be the keys then?
17th Sep 2017, 6:11 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 6
Hmm... maybe like this? i = 0 d = {} n = "" while 1: n = input() if n == "": break d[i] = n i += 1 print(d) # dictionary is an unordered set, so you can do a trick and add the keys which are ordered. So that you can iterate them later in the same order the entries were added
17th Sep 2017, 7:46 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
0
Kay's and it's value should be anything I just want how to gets values via looping that's set .
17th Sep 2017, 7:35 AM
mukesh kumar rao
mukesh kumar rao - avatar
0
thanks alots
3rd Oct 2017, 6:22 PM
mukesh kumar rao
mukesh kumar rao - avatar