Basics of Python-8

Hello, I'm Priya Chakraborty, a dedicated B.Tech student in Electrical Engineering at Siliguri Institute Of Technology. I'm an enthusiastic learner, constantly seeking to expand my skill set and knowledge base. With a solid foundation in programming languages such as C, R, Python, and MySQL, I'm poised to tackle complex technical challenges.
But my passions extend beyond the realm of engineering. I'm also an aspiring content writer, driven by a curiosity to communicate ideas, both technical and non-technical, in a way that captivates and educates.
My journey is defined by a relentless pursuit of self-improvement, coupled with strong communication skills. I believe in the power of continuous learning and the importance of sharing knowledge.
Day 8
Dictionary :
An unordered collection of data types that has a "Key" and "Value".
The key is immutable whereas the value is mutable.
Let's solve a problem :
- Write a python program to sort a dictionary based on keys.
from collections import OrderedDict
dict={'Me':10,'you':1,'us':34}
y=list(dict.keys())
#this will sort on the basis of key
x=OrderedDict(sorted(dict.items()))
print(x)
output :

More Problems :
Write a python program to Sort Python Dictionaries by Key or Value
Write a python program to Handle missing keys in Python dictionaries
Write a python program to find the sum of all items in a dictionary
Write a python program to find the size of a Dictionary
Write a python program to Merge two Dictionaries
Write a python program to create a grade calculator in Python
Write a python program to Check the order of characters in a string using OrderedDict( )
Write a python program to Find common elements in three sorted arrays by dictionary intersection
Write a python program to Find all duplicate characters in a string
Write a python program to Replace String with Kth Dictionary value
Write a python program to remove a key from the dictionary
Write a python program to Replace words from the Dictionary
Write a python program to Remove Dictionary Key Words
In my next blog, you will get to know about loops in python.
Thank you!




