Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Creating a Dictionary using built-in function dict()

# welcome to softhunt.net
# Creating an empty Dictionary
Dictionary = {}
print("Empty Dictionary: ")
print(Dictionary)

# Creating a Dictionary
# with Dictionary() method
Dictionary = dict({0: 'Softhunt', 1: '.net', 2: 'By', 3: 'Ranjeet'})
print("
Dictionary with the use of dict(): ")
print(Dictionary)

# Creating a Dictionaryionary
# with each item as a Pair
Dictionary = dict([(0, 'Ranjeet'), (1, 'Kumar'), (2, 'Andani')])
print("
Dictionary with each item as a pair: ")
print(Dictionary)
Comment

PREVIOUS NEXT
Code Example
Python :: call a Python range() using range(start, stop) 
Python :: Double all numbers using a map() and Lamda Function 
Python :: python code to java code converter 
Python :: django hash password Argon 
Python :: how can I edit the history in python shell 
Python :: ccacxc 
Python :: python tkinter.ttk combobox down event on mouseclick 
Python :: list x[:-1] 
Python :: find smallest element not present in list python 
Python :: how to create function python 
Python :: pandas groupby min get index 
Python :: how to loop 10 times in python 
Python :: object get in djangi 
Python :: How to send an image that was sent with a post request to a model for prediction 
Python :: Flask error: werkzeug.routing.BuildError 
Python :: get command line variables python 
Python :: for y in range(10): for x in range(y): print("*",end=') print() 
Python :: random pick and remove index pandas 
Python :: ring define private attributes and methods 
Python :: how to add log to a variable in plotly 
Python :: plot a list of number in python 
Python :: Problems with flask bootstrap 
Python :: player to walk on the surface 
Python :: custom 3d image generator for segmentation 
Python :: python apply file line 
Python :: what does // mean in python 
Python :: python generator in while loop 
Python :: max path limit python 
Python :: how to incorportate a different language in python code 
Python :: advanced use of tuples in python 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =