Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Challenge: Building a Composed Warrior | Einführung in Python OOP
Practice
Projects
Quizzes & Challenges
Quizze
Challenges
/
Objektorientierte Programmierung in Python

bookChallenge: Building a Composed Warrior

Aufgabe

Swipe to start coding

Practice using composition by building a simple warrior game:

  • Create a Weapon class with a name and attack value.
  • Create a Warrior class with a name that can equip a weapon (store it as an attribute) and has a method to show its current weapon.
  • Equip the warrior with the weapon.
  • Use composition. The warrior should have a weapon, not inherit from it.

Lösung

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 18
single

single

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

close

bookChallenge: Building a Composed Warrior

Swipe um das Menü anzuzeigen

Aufgabe

Swipe to start coding

Practice using composition by building a simple warrior game:

  • Create a Weapon class with a name and attack value.
  • Create a Warrior class with a name that can equip a weapon (store it as an attribute) and has a method to show its current weapon.
  • Equip the warrior with the weapon.
  • Use composition. The warrior should have a weapon, not inherit from it.

Lösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 18
single

single

some-alt