Adventurers need experience points (XP) to level up and become stronger. We want to show the total XP a player has gained given their current level.
Each character starts with 0 XP at level 1. To reach the next level, they need to accumulate additional XP equal to their current level times 5.
For example:
1 * 5) added to the current XP so far (0).2 * 5) added to the current XP so far (5).3 * 5) added to the current XP so far (15).To summarize the calculation in a table:
| Level | XP so far | XP for next level |
|---|---|---|
| 1 | 0 | 5 |
| 2 | 5 | 10 |
| 3 | 15 | 15 |
| 4 | 30 | 20 |
Complete the calculate_experience_points function.
It accepts a level (integer) and returns the total XP a player has gained so far.