Solution to problem 8 in Python
This commit is contained in:
parent
46d51b8548
commit
7ec3bd29d6
@ -121,15 +121,16 @@ def part_2() -> None:
|
||||
if layer[pixel] == 2:
|
||||
continue
|
||||
full_image.append(layer[pixel])
|
||||
# only grab the first non-transparent pixel
|
||||
break
|
||||
|
||||
for idx, pixel in enumerate(full_image):
|
||||
# only black (0) and white (1) pixels are in the full image
|
||||
if pixel == 0:
|
||||
print(" ", end="")
|
||||
elif pixel == 1:
|
||||
print("X", end="")
|
||||
elif pixel == 2:
|
||||
print("o", end="")
|
||||
# wrap around image's width (25 pixels)
|
||||
if (idx + 1) % 25 == 0:
|
||||
print()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user