After chatGPT

mail@pastecode.io avatar
unknown
python
a year ago
1.2 kB
7
Indexable
Never
from datetime import datetime


class User:
    """
    The class represents a user.

    :param first_name: The first name of the user.
    :type first_name: str
    :param last_name: The last name of the user.
    :type last_name: str
    :param birth_year: The birth year of the user.
    :type birth_year: int
    """
    def __init__(self, first_name, last_name, birth_year):
        self.first_name = first_name
        self.last_name = last_name
        self.birth_year = birth_year

    def get_full_name(self):
        """
        Returns the full name of the user.

        :return: The full name of the user.
        :rtype: str
        """
        return f"{self.first_name} {self.last_name}"

    def get_age(self):
        """
        Returns the age of the user.

        :return: The age of the user.
        :rtype: int
        """
        return datetime.now().year - self.birth_year

    def how_much_will_be_age(self, year):
        """
        Returns how old the user will be in a given year.

        :param year: The year to calculate the user's age in.
        :type year: int
        :return: How old the user will be in the given year.
        :rtype: int
        """
        return year - self.birth_year