0

Can we take input to dictionary key from a range, list or a set?

Ex A = {1: b[ ]} while b = [ input] Input could be range or list Please eleborate!

21st Jun 2021, 3:33 AM
Zahed Shaikh
Zahed Shaikh - avatar
1 Odpowiedź
+ 2
one way to do that would be a={} a[1]=input() or a={} b=[1,2,3,4,5] a[1]=b or a={} b=input() a[1]=b.split(‘,‘) # replace , with any separator you are using in your input.
21st Jun 2021, 7:01 AM
you are smart. you are brave.
you are smart. you are brave. - avatar