Skip to content

Commit 1c910e6

Browse files
7
1 parent 32180e0 commit 1c910e6

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

7.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from PIL import Image
2+
3+
im = Image.open("smarty/oxygen.png")
4+
5+
start_x = 0
6+
end_x = 608
7+
8+
start_y = 43
9+
end_y = 52
10+
y=50
11+
12+
13+
start_x = 5
14+
end_x = 607
15+
result = chr(115)
16+
# print("0,50 - (115, 115, 115, 255)")
17+
for x in range(start_x, end_x, 7):
18+
# print("{},{} - {}".format(x, y, im.getpixel((x, y))))
19+
c = im.getpixel((x, y))[0]
20+
result += chr(c)
21+
22+
result2 = ""
23+
ary = [105, 110, 116, 101, 103, 114, 105, 116, 121]
24+
for i in range(len(ary)):
25+
result2 += chr(ary[i])
26+
27+
print(result)
28+
print(result2)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
Solve Problems in http://www.pythonchallenge.com
33

44
#### 7
5-
result:
5+
result: http://www.pythonchallenge.com/pc/def/integrity.html
66
```
77
from PIL import Image
88
```
9-
9+
use PIL module to find the block's pixel with getpixel, then use chr() to translate the code
1010

1111
#### 6
1212
result: http://www.pythonchallenge.com/pc/def/oxygen.html

0 commit comments

Comments
 (0)