Hello,
My solution for the task is:
def house(plan):
height_min_max = []
height = 0
width_min = []
width_max = []
width = 0
for index, line in enumerate(plan.splitlines()):
if '#' in line:
height_min_max.append(index)
width_min.append(line.find('#')+1)
width_max.append(line.rfind('#')+1)
width = max(width_max) - min(width_min)
if height_min_max:
height = max(height_min_max) - min(height_min_max) + 1
return width*height
I've got error in the final test:
Fail:house("0000##0000\n#000##000#\n##########\n##000000##\n0########0\n")
Your result:45
But in the editor it's - 50
Please, help
Thanks
Created at: 2019/04/19 08:14; Updated at: 2019/04/19 11:22
The question is resolved.