Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Challenge: Creating Notification System Blueprint | Introductie tot Python OOP
Practice
Projects
Quizzes & Challenges
Quizzen
Challenges
/
Objectgeoriënteerd Programmeren in Python

bookChallenge: Creating Notification System Blueprint

Taak

Swipe to start coding

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.

Oplossing

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 14
single

single

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

close

bookChallenge: Creating Notification System Blueprint

Veeg om het menu te tonen

Taak

Swipe to start coding

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.

Oplossing

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 14
single

single

some-alt