import copy


class Ipv4:
    def __init__(self, address_ipv4):
        self.address = address_ipv4

    def set_ipv4_num(self, first, second, third, four):
        self.address = f"{first}.{second}.{third}.{four}"

    def __repr__(self):
        return self.__str__()

    def __str__(self):
        return self.address

    def __eq__(self, other):
        if (isinstance(other, Ipv4)):
            return self.address == other.address
        return False

    def numeric_address(self):
        return [int(x) for x in self.address.split(".")]

    def increment(self):
        addressSplitted = self.address.split(".")
        for index, item in enumerate(addressSplitted.reverse()):
            item = str(self.__calculate_value(index=index, number=int(item)))
            if addressSplitted[item] != '0':
                break
        self.address = ".".join(addressSplitted)

    def __calculate_value(self, *, index, number):
        if index > 0:
            return 0 if number == 255 else (number + 1)
        else:
            return 255 if number == 255 else (number + 1)


def calculate_scope_ipv4(beginIpv4, endIpv4):
    result = []
    actualIpv4 = copy.copy(beginIpv4)
    while actualIpv4 != endIpv4:
        result.append(str(actualIpv4))
        actualIpv4.increment()
    return result


print("Provide the scope of ipv4 addresses")
beginIpv4 = Ipv4(input("Begin: "))
endIpv4 = Ipv4(input("End: "))
print(calculate_scope_ipv4(beginIpv4, endIpv4))

import copy


class Ipv4:
    def __init__(self, address_ipv4):
        self.address = address_ipv4

    def set_ipv4_num(self, first, second, third, four):
        self.address = f"{first}.{second}.{third}.{four}"

    def __repr__(self):
        return self.__str__()

    def __str__(self):
        return self.address

    def __eq__(self, other):
        if (isinstance(other, Ipv4)):
            return self.address == other.address
        return False

    def numeric_address(self):
        return [int(x) for x in self.address.split(".")]

    def increment(self):
        addressSplitted = self.address.split(".")
        for index, item in enumerate(addressSplitted.reverse()):
            item = str(self.__calculate_value(index=index, number=int(item)))
            if addressSplitted[item] != '0':
                break
        self.address = ".".join(addressSplitted)

    def __calculate_value(self, *, index, number):
        if index > 0:
            return 0 if number == 255 else (number + 1)
        else:
            return 255 if number == 255 else (number + 1)


def calculate_scope_ipv4(beginIpv4, endIpv4):
    result = []
    actualIpv4 = copy.copy(beginIpv4)
    while actualIpv4 != endIpv4:
        result.append(str(actualIpv4))
        actualIpv4.increment()
    return result


print("Provide the scope of ipv4 addresses")
beginIpv4 = Ipv4(input("Begin: "))
endIpv4 = Ipv4(input("End: "))
print(calculate_scope_ipv4(beginIpv4, endIpv4))
