Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele Challenge: Creating Notification System Blueprint | Johdanto Pythonin Olio-Ohjelmointiin
Practice
Projects
Quizzes & Challenges
Visat
Challenges
/
Olio-ohjelmointi Pythonissa

bookChallenge: Creating Notification System Blueprint

Tehtävä

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.

Ratkaisu

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 1. Luku 14
single

single

Kysy tekoälyä

expand

Kysy tekoälyä

ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

close

bookChallenge: Creating Notification System Blueprint

Pyyhkäise näyttääksesi valikon

Tehtävä

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.

Ratkaisu

Switch to desktopVaihda työpöytään todellista harjoitusta vartenJatka siitä, missä olet käyttämällä jotakin alla olevista vaihtoehdoista
Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 1. Luku 14
single

single

some-alt