Skip to content

Commit 371c848

Browse files
committed
Refactor solution to mission 28
1 parent 4fb05b2 commit 371c848

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

28-bell.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111
# http://www.pythonchallenge.com/pc/ring/bell.html
1212

1313
from auth import get_last_src_url
14-
from auth import open_url
14+
from auth import read_url
15+
from io import BytesIO
1516
from itertools import islice
1617
from PIL import Image as Image
1718

1819

1920
img_url = get_last_src_url("http://www.pythonchallenge.com/pc/ring/bell.html")
20-
greens = islice(Image.open(open_url(img_url)).tobytes(), 1, None, 3)
21+
greens = islice(Image.open(BytesIO(read_url(img_url))).tobytes(), 1, None, 3)
2122
for curr, prev in zip(greens, greens):
22-
if abs(curr - prev) != 42: # the ultimate answer, oh!!! Boring mission 😒
23+
if abs(curr - prev) != 42: # 😱 the ultimate answer! Boring mission 😒
2324
print(chr(abs(curr - prev)), end="")
25+
print(" (hint: ‘it’ is Python)")

0 commit comments

Comments
 (0)