Calculate Island mission looks bugged
I would like to give some feedback about Calculate Island mission From: https://py.checkio.org/mission/calculate-islands/solve/
Tests look bugged, I have right resuls on my computer, I have right results in Tryit console, but keep getting error "TypeError: <class 'list'> is wrong data type" for the first test when I check my solution. Can't find what I'm doing wrong.
Here is my code:
import numpy as np def colorize(arr, max_color, land_map): color = arr.max() if color == 1: color = max_color + 1 for y in range(arr.shape[0]): for x in range(arr.shape[1]): if arr[y][x] == 1: arr[y][x] = color if 1 < arr[y][x] < color : land_map[:,:] = (land_map + (land_map == arr[y][x])*(color - arr[y][x]))[:,:] return color def checkio(land_map): land_map = np.array(land_map) size_y, size_x = land_map.shape max_color = 1 for y in range(size_y): for x in range(size_x): if land_map[y][x] > 0: color = colorize(land_map[max(0,y-1):min(size_y,y+1)+1 , max(0,x-1):min(size_x,x+1)+1], max_color, land_map) max_color = max(color, max_color) island_sizes = [] for i in range(2, max_color + 1): s = (land_map == i).sum() if s > 0: island_sizes.append(s) return sorted(island_sizes)
HTTP_USER_AGENT:
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36