class Strength(State):
def run(self, gamedata):
print("You have 100 points to assign to your character.\n Start now to assign those Points to your characters strength, agility, speed and defense.")
strenghtwert = int(input("STRENGTH: >>"))
return AGILITY, gamedata, strenghtwert
def next(self, next_state):
if next_state == AGILITY:
return CreatePlayer.agility
class Agility(State):
def run(self, gamedata,strenghtwert):
agilitywert = int(input("AGILITY: >>"))
return SPEED, gamedata, strenghtwert, agilitywert
def next(self, next_state):
if next_state == SPEED:
return CreatePlayer.speed
Quand j'exécute cela, je reçois l'erreur: ValueError: too many values to unpack (expected 2)
. Je pense que l'erreur est dans return AGILITY, gamedata, strenghtwert
dans run()
dans la classe Strength
.ValueError: trop de valeurs à déballer (expected 2) PYTHON
Une idée quel est le problème?
La dernière ligne exécutée avec succès est strenghtwert = int(input("STRENGTH: >>"))
dans la même fonction.
nous montrent la trace de la pile – acushner
Montrez-nous comment vous appelez la fonction. – Antimony