diff --git a/CODES.PY/dictionary.py b/CODES.PY/dictionary.py index 4716af6..8978436 100644 --- a/CODES.PY/dictionary.py +++ b/CODES.PY/dictionary.py @@ -13,3 +13,13 @@ record={"n":"Arjun","age":20,"dep":"Developer"} print(record) print(record["n"]); + +# To input a dictionary +d = {} +n = input("Enter number of key-value pairs/ elements you want in your dictionary") +while n>0: + k = input("enter the key") + v = input("enter the value") + d[k] = v + n = n-1 +print(d[k])