Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Challenge: Building a Composed Warrior | Introducción a la POO en Python
Programación Orientada a Objetos en Python

bookChallenge: Building a Composed Warrior

Tarea

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.

Solución

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 1. Capítulo 18
single

single

Pregunte a AI

expand

Pregunte a AI

ChatGPT

Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla

close

bookChallenge: Building a Composed Warrior

Desliza para mostrar el menú

Tarea

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.

Solución

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 1. Capítulo 18
single

single

some-alt