← Back to challenges

Battle Game

PythonHardgamesnumbers

Instructions

You were bored, so you decided to try out a new game you recently downloaded. There are five types of characters, each with their own level of attack power, defense, and speed. There are also five types of armor, weapons, and boots. Each type of item has a different cost of gold and a different level of attack power, defense or speed.

Create a function that takes the type of character and the amount of gold. The function should return the maximum amount of attack power possible, the maximum amount of defense possible, and the maximum speed possible in a list, in that order.

Examples

max_stats("Robot", 160) ➞ [210, 220, 26]

max_stats("Fairy", 50) ➞ [91, 120, 22]

max_stats("Warrior", 70) ➞ [210, 211, 14]

Notes

  • Calculate the attack power, defense, and speed seperately. Do not calculate combinations of items.
  • Hint: Add the character's stats to the items' stats for the result.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.