LearnPy Hub
← Pandas: DataFrames problems
Hard

Join a Department Table

After the students, a second block lists departments: lines code full_name_with_underscores until END. Left-merge the students with it on the department code, fill missing full names with Unknown, replace underscores with spaces, and print each student as name: Full Name in the original order.

Input

Lines 'name dept cgpa credits', then END. Then lines 'code name', then END.

Output

Lines.

Sample 1

Input
Mim CSE 3.82 120
Rafi EEE 3.41 98
Sara CSE 3.95 132
Tuhin BBA 3.60 110
Nadia CSE 3.71 125
END
CSE Computer_Science
EEE Electrical_Engineering
END
Output
Mim: Computer Science
Rafi: Electrical Engineering
Sara: Computer Science
Tuhin: Unknown
Nadia: Computer Science

Sample 2

Input
A CSE 3.00 100
END
END
Output
A: Unknown
solution.py
Output appears here
Join a Department Table · Python practice problem · LearnPy Hub