LearnPy Hub
← File Handling problems
Medium

Save as JSON

Read n lines of key value (n first), save them as a dictionary to data.json with json.dump, load the file back and print the keys sorted and the number of entries.

Input

n, then n lines.

Output

Two lines.

Sample 1

Input
2
b 1
a 2
Output
a b
2

Sample 2

Input
1
x y
Output
x
1
solution.py
Output appears here
Save as JSON · Python practice problem · LearnPy Hub