the-honk/languages/python/pythonchallenge.com/7 - Oxygen.py

11 lines
308 B
Python
Raw Normal View History

2024-10-09 17:02:27 +00:00
import re
from PIL import Image
img = Image.open('oxygen.png')
row = [img.getpixel((x, img.height / 2)) for x in range(img.width)][::7]
ords = [r for r, g, b, a in row if r == g == b]
msg = ''.join(map(chr, ords))
nums = re.findall('\d+', msg)
nextLevel = ''.join(map(chr, map(int, nums)))
print(nextLevel)