my solve looks like this:
def house(plan):
check = plan.replace("'''","")
check = check.replace("\n","")
if check.isdigit() == True:
return 0
newlist = plan.split('\n')
newlist.pop()
newlist.pop(0)
width = 0
lengh = 0
try:
while newlist[0].count('#') == 0:
newlist.pop(0)
while newlist[-1].count('#') == 0:
newlist.pop()
except:
return 0
for i in newlist:
width +=1
long = i.rfind('#')-i.find('#')+1
print(long,' long')
if long > lengh:
lengh = long
return (width*lengh)
I have a fail on last check: Fail:house("0000##0000\n#000##000#\n##########\n##000000##\n0########0\n") Your result:40
Right result:50
but then i put this block in my editor and try, code working fine and i've got result 50.
Created at: 2019/04/10 09:44; Updated at: 2019/04/12 08:25
The question is resolved.