HW5Q1.2

user_7676782 avatar
user_7676782
python
01/07/2023 1:49 PM
572 B
22
Indexable
class Diet:
    def __init__(self, year_of_birth, gender):
        self.__year_of_birth = year_of_birth
        self.__gender = gender
        self.__calories = 1000

    def eat_more(self):
        self.__calories += 100

    def get_eat(self):
        return self.__calories

    def eat_less(self):
        self.__calories -= 100

    def __str__(self):
        return "The calories is: "+ str(self.__calories)
Editor is loading...