Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

create nested dictionary with user input in python

d = {}

size = int(input("Enter the size of nested dictionary: "))
for i in range(size):
    
    dict_name = input("Enter the name of child dictionary: ")
    d[dict_name] = {}
    Name = input("Enter name: ")
    Age = input("Enter Age: ")
    d[dict_name]["Name"] = Name
    d[dict_name]["Age"] = Age
    
print(d)
Comment

PREVIOUS NEXT
Code Example
Python :: ploting bargraph with value_counts 
Python :: appending objects to a list contained in a dictionary python 
Python :: Check if file already existing 
Python :: pandas read csv dtype list 
Python :: how to use modulo in python 
Python :: numpy indexing arrays 
Python :: django validators import 
Python :: python - join two columns and transform it as index 
Python :: capitalize python 
Python :: scrapy selenium screnshot 
Python :: scree plot sklearn 
Python :: get number in string python 
Python :: django model example 
Python :: If elif else 
Python :: concact geodataframe python 
Python :: upload file to aws 
Python :: deep learning with python 
Python :: .format python 3 
Python :: download unsplash images python no api 
Python :: python convert 
Python :: append string python 
Python :: digital differential analyzer 
Python :: how to capture video in google colab with python 
Python :: how to read json from python 
Python :: python for loop increment 
Python :: python lambda key sort 
Python :: hide tkinter window 
Python :: python is not clickable at point (434, 682). Other element would receive the click: 
Python :: how to count substring in a string in python 
Python :: python boolean operators 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =