I have type a code using classes and without using classes but i cant find why classes are useful.Both give the same output.Please help Here are the codes ;
1)
class Hero:
    def __init__(self,name,health,p,s):
        self.name=name
        self.health=health
        self.p=int(p)
        self.a=int(s)
        food=vars()
        print(self.name,self.health)
        self.eat()
        print(self.health)
    def eat(self):
        print('choose a or b')
        food=input('>')
        if food == 'a':
            self.health -= self.p
        elif food == 'b':
            self.health += self.a
        else:
            print('choose one among a and b')
Hero('Bob',100,10,5)
Hero('Ham',500,60,10)
2)
def eat(health,p,a):
    print('choose a or b')
    food=input('>')
    if food == 'a':
        health -= int(p)
    elif food == 'b':
        health += int(a)
    else:
        print('choose one among a and b')
    return health
def Hero(name,health,p,a):
    print(name,health)
    health = eat(int(health),p,a)
    print(health)
Hero('Bob',100,10,5)
Hero('Ham',500,60,10)
Someone please help.
 
     
     
    