Skip to content

Commit b80a86b

Browse files
try 18
1 parent 07ffe0c commit b80a86b

File tree

7 files changed

+4617
-7
lines changed

7 files changed

+4617
-7
lines changed

17.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def main():
2+
pass
3+
4+
5+
if __name__ == "__main__":
6+
main()

18-1.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+
4+
def main():
5+
im, width, height = open_a_picture("swan/balloons.jpg")
6+
get_pixels_rgb(im, 0, 0, 10, 10)
7+
print()
8+
get_pixels_rgb(im, int(width / 2), 0, int(width / 2) + 10, 10)
9+
10+
11+
def open_a_picture(dir):
12+
im = Image.open(dir)
13+
size = im.size
14+
width = size[0]
15+
height = size[1]
16+
print("balloons'width is {}, balloons'height is {}".format(width, height))
17+
return im, width, height
18+
19+
20+
def get_pixels_rgb(im, start_x, start_y, end_x, end_y):
21+
for x in range(start_x, end_x):
22+
for y in range(start_y, end_y):
23+
print(im.getpixel((x, y)), end=" ")
24+
print("")
25+
26+
27+
if __name__ == "__main__":
28+
main()

18-2.py

Whitespace-only changes.

18.py

Lines changed: 0 additions & 6 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ gunzip deltas.gz
1111
#### 17
1212
result: http://www.pythonchallenge.com/pc/return/balloons.html
1313

14-
this is funny.
14+
1.
1515

1616
#### 16
1717
result: http://www.pythonchallenge.com/pc/return/romance.html

swan/left

Lines changed: 2291 additions & 0 deletions
Large diffs are not rendered by default.

swan/right

Lines changed: 2291 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)