From 8a207af2a8e6d82d61bd9d4536b3fbfee59e50d5 Mon Sep 17 00:00:00 2001 From: Mysha Afrin Jeba Date: Mon, 9 Jun 2025 12:07:10 +0600 Subject: [PATCH] Create taking_input_for_dict.py --- .../book's concept/taking_input_for_dict.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 python crush course/chapter-6/dictionary/book's concept/taking_input_for_dict.py diff --git a/python crush course/chapter-6/dictionary/book's concept/taking_input_for_dict.py b/python crush course/chapter-6/dictionary/book's concept/taking_input_for_dict.py new file mode 100644 index 0000000..730fd7d --- /dev/null +++ b/python crush course/chapter-6/dictionary/book's concept/taking_input_for_dict.py @@ -0,0 +1,11 @@ +#Empty dictionary. +my_dict = {} +#Numbers of items to add. +n = int(input("How many items do you want to add to the dictionary?")) +#Loop to add items to the dictionary. +for i in range(n): + key = input("Enter the key:") + value = input("Enter the value:") + my_dict[key] = value +#Print the final dictionary. + print("Final dictionary is:", my_dict)