47日目-Count IP Addresss



--------------------------------------------🤞 My Solution -----------------------------------------
def ips_between(start, end):
    start = start.split('.')
    start.reverse()
    start = list(map(int, start))
    end = end.split('.')
    end.reverse()
    end = list(map(int, end))

    arr = []
    start_num = 0
    end_num = 0
    for i in range(0, start.__len__()):
        if i == 0:
            start_num += start[0]
            end_num += end[0]
        if i == 1:
            if start[i] != 0:
                start_num += 256 * start[i]
            if end[i] != 0:
                end_num += 256 * end[i]
        if i == 2:
            if start[i] != 0:
                start_num += 256 * 256 * start[i]
            if end[i] != 0:
                end_num += 256 * 256 * end[i]
        if i == 3:
            if start[i] != end[i]:
                if start[i] != 0:
                    start_num += 256 * 256 * 256 * start[i]
                if end[i] != 0:
                    end_num += 256 * 256 * 256 * end[i]
    arr.append(start_num)
    arr.append(end_num)
    result = arr[1] - arr[0]
    return result
5 kyuにアップグレードし、、、