Skip to content

Commit 600aec0

Browse files
try to solve 14
1 parent 5210b8d commit 600aec0

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

14-1.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@
4040
sum = 0
4141
for j in range(len(ary2[i])):
4242
sum += ary2[i][j]
43-
print(sum)
43+
print(sum)
44+
print(len(ary2))

14.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from PIL import ImageDraw
33

44
im = Image.open("wire/wire.png")
5-
result = Image.new("RGB", (100, 100), "white")
5+
result = Image.new("RGB", (400, 50), "white")
66
drawer = ImageDraw.Draw(result)
77

88
im_size = im.size
@@ -14,11 +14,18 @@
1414
result_y = result_size[1]
1515

1616
count = 0
17-
for y in range(result_y):
18-
for x in range(result_x):
19-
# print("count is {}, im.getpixel((count,0)) is{}".format(count,im.getpixel((count, 0))))
20-
drawer.point((x, y), im.getpixel((count,0)))
17+
x = 0
18+
y = 0
19+
while y < result_y:
20+
while x < result_x:
21+
drawer.point((x, y), im.getpixel((count, 0)))
22+
print("y is {}, x is {}, count is {}".format(y, x, count))
23+
x += 1
2124
count += 1
25+
if y % 2 == 0:
26+
result_x -= 1
27+
y += 1
28+
x = 0
2229

23-
result.show()
24-
result.save("wire/result.png")
30+
31+
result.show()

0 commit comments

Comments
 (0)