Seems simple, yet elusive, want to build a dict from input of [key,value] pairs separated by a space using just one Python statement. This is what I have so far:
n = int(input()) #n is the number of items you want to enter
d ={}
for i in range(n):
text = input().split() #split the input text based on space & store in the list 'text'
d[text[0]] = text[1] #assign the 1st item to key and 2nd item to value of the dictionary
print(d)
INPUT:
3
A1023 CRT
A1029 Regulator
A1030 Therm
NOTE: I have added an extra line for each input for getting each input on individual lines on this site. As placing without an extra line creates a single line.
OUTPUT:
{'A1023': 'CRT', 'A1029': 'Regulator', 'A1030': 'Therm'}