Python Challenge[33]

[Level 33]

Python Challenge[33]_第1张图片

Title: 33 bottles of beer on the wall

最终从源码中得到 beer2.png。结合之前的提示

If you are blinded by the light,
remove its power, with its might.
Then from the ashes, fair and square,
another truth at you will glare.

嗯,没懂。去除亮点,剩余的数是平方数,重新组成图。

from PIL import Image
import math

with Image.open('beer2.png') as img:
  data = list(img.getdata())
for i in range(254, -1, -1):
  imgData = [d for d in data if d < i]
  x = math.sqrt(len(imgData))
  if x == int(x) and x > 0:
    newImg = Image.new('L', (int(x), int(x)))
    newImg.putdata(imgData)
    newImg.save('img/'+str(x)+'.png')

得到好多个字母,外边有方框的字母组成 gremlins,Temporary End

Python Challenge Wiki

你可能感兴趣的:(Python Challenge[33])