Merge Dictionaries

Easy Dictionaries PRO
🔒 Login to Unlock

Problem Statement

Write a Python program to merge two dictionaries and print the combined dictionary.

Input Format

Line 1: Two keys and values for dict 1. Line 2: Two keys and values for dict 2.

Output Format

Print the merged dictionary.

Constraints

Valid input strings

Sample Input

a 1 b 2
c 3 d 4

Sample Output

{'a': '1', 'b': '2', 'c': '3', 'd': '4'}

Explanation

Merge dictionaries using the merge operator `|` or `.update()`.

Starter Code

def merge_dicts(k1, v1, k2, v2, k3, v3, k4, v4):
    d1 = {k1: v1, k2: v2}
    d2 = {k3: v3, k4: v4}
    # Write your code here
    pass

k1, v1, k2, v2 = input().split()
k3, v3, k4, v4 = input().split()
print(merge_dicts(k1, v1, k2, v2, k3, v3, k4, v4))

Limits

  • Time Limit: 1s
  • Memory Limit: 256MB

Embedded C Programming

Updated: March 15, 2026
Intermediate

Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used