
▲ 4 r/learnpython
Stuck solving this puzzle
I'm trying to solve a puzzle with the Robot. I need to move it to the final position using the "for" loop, and all the marked cells must be painted. I did it but it requires a more efficient solution. Any ideas?
Starting position: https://imgur.com/rYMMPNL
The result I currently have: https://imgur.com/ufWocut
This is my code:
from robot import *
task("for28")
move_down()
for i in range(3):
paint()
move_right()
for i in range(3):
move_left()
move_down()
for i in range(4):
paint()
move_right()
for i in range(4):
move_left()
move_down()
for i in range(5):
paint()
move_right()
u/DifferenceSame9771 — 3 days ago