Python Bài 7.A2: Từ điển mini


LÀM BÀI

Points: 10 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
Python

Mô tả bài toán

Tạo từ điển Anh-Việt đơn giản với các thao tác: Thêm từ mới, Tra từ, Cập nhật nghĩa, Xem tất cả từ

INPUT FORMAT

  • Dòng 1: N - số lệnh
  • N dòng tiếp theo, mỗi lệnh:
    • NEW word meaning: thêm từ mới
    • FIND word: tra từ
    • UPDATE word meaning: cập nhật nghĩa
    • LIST: liệt kê từ điển

OUTPUT FORMAT

  • NEW: "Added" hoặc "Word exists"
  • FIND: Nghĩa của từ hoặc "Not found"
  • UPDATE: "Updated" hoặc "Not found"
  • LIST: Các từ theo alphabet

VÍ DỤ

Input:
4
NEW cat mèo
NEW dog chó
FIND cat
LIST
Output:
Added
Added
mèo
cat: mèo
dog: chó

Giải thích

  • Lệnh 1: Thêm từ "cat" với nghĩa "mèo" → Added
  • Lệnh 2: Thêm từ "dog" với nghĩa "chó" → Added
  • Lệnh 3: Tra nghĩa của "cat" → "mèo"
  • Lệnh 4: In toàn bộ từ điển theo thứ tự alphabet

Comments

There are no comments at the moment.

Zalo