You need to create a weapon class with the two attributes. Also you need to add the two mentioned methods of the
character
class:
Replace_weapon(w)
and
List_weapons()
. As far as I can see that is all that is required. Once you have that you can create a
character
object, add some weapons and list them, something like:
fighter = character()
axe = weapon("axe", 20)
fighter.Replace_weapon(axe)
fighter.List_weapons()
See also
9. Classes — Python 3.11.0 documentation[
^].