Make a dictionary in Python from input values

前端 未结 10 1387
情深已故
情深已故 2021-02-03 12:06

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:



        
10条回答
  •  遇见更好的自我
    2021-02-03 12:46

    I have taken an empty dictionary as f and updated the values in f as name,password or balance are keys.

    f=dict()
    f.update(name=input(),password=input(),balance=input())
    print(f)
    

提交回复
热议问题