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

bookChallenge: Building a Composed Warrior

Taak

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.

Oplossing

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 18
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: Building a Composed Warrior

Veeg om het menu te tonen

Taak

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.

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 18
single

single

some-alt