🏠 Home  📔 Blog   🧪 Lab     💻 Git     🎥 TV     🐰 Me     🐦 To me

Reeborg (13) python (13) Scratch (8) Minecraft (4) lua (2) TED (1) etc. (1) science (1)

2022년 11월 18일 금요일

정원사 로봇 리보그(초급) - T-2. 잡초 제거

잡초 제거


1. 다음 코드를 실행하면 몇 송이의 꽃을 뽑을 수 있을까요?


repeat 10:
    move()
    if object_here():
        take()

 

2. 다음 코드를 실행하면 몇 송이의 꽃을 뽑을 수 있을까요?

def turn_right():
    repeat 3:
        turn_left()

def turn_around():
    repeat 2:
        turn_left()

def move_and_pick():
    move()
    take()

def weeding_time():
    repeat 2:
        move_and_pick()

repeat 4:
    move()
turn_left()
move()
turn_left()

weeding_time()
move()
turn_right()
move()
turn_right()

weeding_time()
move()

 

 

댓글 없음:

댓글 쓰기