top of page
Writer's picturePriyanshu Kanade

Python | Concatenate two dictionaries into one

In this post, we will learn about how to concatenate two dictionaries into one in python.

Two dictionaries d1 and d2 are concatenated.

d1 = {'ramesh': 400, 'rahul':655,'rohit':600,'ritu':750}
d2 = {'riya':200,'ritika':450,'ruhani':800}
d1.update(d2)
print(d1)
Output:
{'ramesh': 400, 'rahul': 655, 'rohit': 600, 'ritu': 750, 'riya': 200, 'ritika': 450, 'ruhani': 800}
 

Happy Coding!

Follow us on Instagram @programmersdoor

Join us on Telegram @programmersdoor


Please write comments if you find any bug in the above code/algorithm, or find other ways to solve the same problem.

Follow Programmers Door for more.

9 views0 comments

Recent Posts

See All

Comments


bottom of page