human
Solve in Python:
![alt text](https://2.bp.blogspot.com/-DNNiOXduuvQ/Vh-FR-qbKXI/AAAAAAAAEOA/HT0IzJ36zW4/s1600/voz.jpg)

Create a class called `Warrior` which calculates and keeps track of their level and skills, and ranks them as the warrior they've proven to be.

Business Rules:

- A warrior starts at level 1 and can progress all the way to 100.
- A warrior starts at rank `"Pushover"` and can progress all the way to `"Greatest"`.
- The only acceptable range of rank values is `"Pushover", "Novice", "Fighter", "Warrior", "Veteran", "Sage", "Elite", "Conqueror", "Champion", "Master", "Greatest"`.
- Warriors will compete in battles. Battles will always accept an enemy level to match against your own.
- With each battle successfully finished, your warrior's experience is updated based on the enemy's level.
- The experience earned from the battle is relative to what the warrior's current level is compared to the level of the enemy.
- A warrior's experience starts from 100. Each time the warrior's experience increases by another 100, the warrior's level rises to the next level.
- A warrior's experience is cumulative, and does not reset with each rise of level. The only exception is when the warrior reaches level 100, with which the experience stops at 10000
- At every 10 levels, your warrior will reach a new rank tier. (ex. levels 1-9 falls within `"Pushover"` tier, levels 80-89 fall within `"Champion"` tier, etc.)
- A warrior cannot progress beyond level 100 and rank `"Greatest"`.

Battle Progress Rules & Calculations:

- If an enemy level does not fall in the range of 1 to 100, the battle cannot happen and should return `"Invalid level"`.
- Completing a battle against an enemy with the same level as your warrior will be worth 10 experience points.
- Completing a battle against an enemy who is one level lower than your warrior will be worth 5 experience points.
- Completing a battle against an enemy who is two levels lower or more than your warrior will give 0 experience points.
- Completing a battle against an enemy who is one...
assistant
#Here the warrior's current level is compared to the level of the enemy.

class Warrior:
    def __init__(self):
        self.xp = 100
        self.ranks = ["Pushover", "Novice", "Fighter", "Warrior", "Veteran", "Sage", "Elite", "Conqueror", "Champion", "Master", "Greatest"]
        self.achievements = []

    @property
    def experience(self):
        return min(self.xp, 10000)
    @property
    def level(self):
        return self.experience//100
    @property
    def rank(self):
        return self.ranks[self.level//10]
    
    def battle(self, level):
        diff = level - self.level
        if not (0<level<=100): return "Invalid level"
        elif diff>4 and self.ranks.index(self.ranks[level//10]) > self.ranks.index(self.rank): return "You've been defeated"
        elif diff>0:
            self.xp += 20*diff*diff
            return "An intense fight"
        elif not diff:
            self.xp += 10
            return 'A good fight'
        elif diff==-1:
            self.xp += 5
            return 'A good fight'
        return "Easy fight"

    def training(self, arr):
        if self.level >= arr[2]:
            self.xp += arr[1]
            self.achievements.append(arr[0])
            return arr[0]
        return "Not strong enough"