← Back to challenges

Innokodakademija Experience Points

PythonHardarraysnumbersstrings

Instructions

As you complete questions on Innokodakademija, you gain experience points depending on the difficulty of the question. The points for each difficulty are as follows:

DifficultyExperience Points
Very Easy5XP
Easy10XP
Medium20XP
Hard40XP
Very Hard80XP

Given a dictionary of how many questions a person has completed of each difficulty, return how many experience points they'll have.

Examples

get_xp({
  "Very Easy" : 89,
  "Easy" : 77,
  "Medium" : 30,
  "Hard" : 4,
  "Very Hard" : 1
}) ➞ "2055XP"

get_xp({
  "Very Easy" : 254,
  "Easy" : 32,
  "Medium" : 65,
  "Hard" : 51,
  "Very Hard" : 34
}) ➞ "7650XP"

get_xp({
  "Very Easy" : 11,
  "Easy" : 0,
  "Medium" : 2,
  "Hard" : 0,
  "Very Hard" : 27
}) ➞ "2255XP"

Notes

Return values as a string and make sure to add "XP" to the end.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Shhh Be Quiet Function