以输入几组个值和键为例
summary = {}
for i in range(0, 3):
key = input(“please input your keys:”)
values = input(“please input your values:”)
if key not in summary.keys():
summary[key] = values
print(“dic =”,summary,end=" ")
print("")
print(“input complete”)
key = input(“inout yout keys:”)
if key in summary.keys():
print(key, ‘values:’, summary[key])
else:
print(“dic is not values”)
初学者编写(大神求指导)