セクション 1. 章 14
single
Challenge: Creating Notification System Blueprint
メニューを表示するにはスワイプしてください
タスク
スワイプしてコーディングを開始
Design a notification system using abstract classes to practice inheritance and polymorphism in Python.
- Create an abstract base class named Notifier with an abstract method send(message).
- Implement two subclasses: EmailNotifier and SMSNotifier. Each should implement the send method and return a string indicating how the notification was sent (for example, "Email sent: ..." or "SMS sent: ...").
- Write a function notify_user(notifier, message) that calls the notifier's send method and returns its result.
- Create one object of each notifier and use notify_user to test both, passing a sample message to each.
解答
すべて明確でしたか?
フィードバックありがとうございます!
セクション 1. 章 14
single
AIに質問する
AIに質問する
何でも質問するか、提案された質問の1つを試してチャットを始めてください