human
Can you provide a the Python code you requested given the following:
I am working on the file "Algoritmos I/2018-2C/clase_objetos.ipynb".
The first task is:
Clase Arma
Can you write Python code for it?
assistant
#Here is the Python code you requested.

class Gun:
    """Clase que representa un arma generica"""
    
    SNIPER = "Sniper"
    MORTAR = "Mortar"
    
    def __init__(self,name,damage,gun_type):
        
        self.name = name
        self.damage = damage
        self.gun_type = gun_type
        
    def attack(self,soldier):
        
        soldier.receive_damage(self.damage,self.gun_type)
        

import random
        
class Soldier:
    """Clase que representa a un soldado"""

    def __init__(self, name,gun):

        self.name = name
        self.gun = gun
        self.hp  =  random.randint(600,1200)
        self.shield = random.randint(1,4)

    def get_name(self):
        """Devuelve el nombre del soldado"""
        return self.name

    def attack(self,enemy):
        """ """
        self.gun.attack(enemy)
        
    def receive_damage(self,damage,gun_type):
        if gun_type == Gun.SNIPER:
            self.hp -= damage / self.shield
            return
        
        self.hp -= damage
        
    def __eq__(self,another):
        return self.name == another.name
    
    def __hash__(self):
        return hash(self.name)