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!
1 Antwort
+ 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.