levels = {0: 2, 1: 5, 2: 15}
def get_level(current_xp):
sorted_levels = dict(sorted(levels.items()))
for level, xp in sorted_levels.items():
if current_xp <= xp:
return level
else:
return list(sorted_levels)[-1]
print(get_level(9))