[lab-data-vikings] Miguel Ceinos#124
Open
MdeMaic wants to merge 6 commits intoironhack-datalabs:masterfrom
Open
[lab-data-vikings] Miguel Ceinos#124MdeMaic wants to merge 6 commits intoironhack-datalabs:masterfrom
MdeMaic wants to merge 6 commits intoironhack-datalabs:masterfrom
Conversation
|
Hellosi! Muy bueno ese teletransporte! Si no te va bien con el mundo del Data, ya sabes... 🚀 Cuando defines el método receiveDamage de Vikings y de Saxons, si que es conveniente que herede de Soldier, y añadas las modificaciones, en vez de volver a definir toda la función. def receiveDamage(self, damage):
super().receiveDamage(damage)
if self.health > 0:
return "{} has received {} points of damage".format(self.name, damage)
else:
return "{} has died in act of combat".format(self.name)Por último, comentarte que cuando haces lo siguiente: status = ""
if len(self.saxonArmy) == 0:
status = "Vikings have won the war of the century!"
elif len(self.vikingArmy) == 0:
status = "Saxons have fought for their lives and survive another day..."
else:
status = "Vikings and Saxons are still in the thick of battle."
return statuspuedes hacerlo de esta manera, usando return para cada condición: if len(self.saxonArmy) <= 0:
return "Vikings have won the war of the century!"
elif len(self.vikingArmy) <= 0:
return "Saxons have fought for their lives and survive another day..."
elif len(self.saxonArmy) > 0 and len(self.vikingArmy) > 0:
return "Vikings and Saxons are still in the thick of battle."Pero para haber estado en Galicia está moi ben |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

🚀