3/8 Python 인강 Day 6 / Day 100
개발/파이썬2023. 3. 8. 20:57
728x90
첫번째 Exam 로봇 점프 ㅋ 꽤 재밌는 과제였다.
def 함수명() : 로 나만의 함수를 만들고 들여쓰기로 기능을 넣는 형태
#Day6 Exam1
def turn_right():
turn_left()
turn_left()
turn_left()
def cycle():
move()
turn_left()
move()
turn_right()
move()
turn_right()
move()
turn_left()
cycle()
cycle()
cycle()
cycle()
cycle()
cycle()
해보고 싶으신분은 https://reeborg.ca/ 여기서 해볼수 있습니다.
Exam2
랜덤 골지점
#Day6 Exam2
#Goal 지점이 나올때까지 while 문 이용 반복
def turn_right():
turn_left()
turn_left()
turn_left()
def cycle():
move()
turn_left()
move()
turn_right()
move()
turn_right()
move()
turn_left()
while not at_goal():
cycle()
Exam3
랜덤 장애물
#Day6 Exam3
def turn_right():
turn_left()
turn_left()
turn_left()
def cycle():
turn_left()
move()
turn_right()
move()
turn_right()
move()
turn_left()
while not at_goal():
if front_is_clear():
move()
elif wall_in_front():
cycle()
게임으로 하니까 쉬운것 같기도하고. 그냥 쉬운 문제를 내준건가 싶기도 하고.
Day6 Exam4
랜덤 장애물 피하기
def turn_right():
turn_left()
turn_left()
turn_left()
def cycle1():
turn_left()
while wall_on_right():
move()
turn_right()
move()
turn_right()
while front_is_clear():
move()
turn_left()
while not at_goal():
if wall_in_front():
cycle1()
else:
move()
오늘 수업은 여기까지.
728x90
'개발 > 파이썬' 카테고리의 다른 글
3/9 Python 인강 Day 7 / Day 100 (0) | 2023.03.09 |
---|---|
3/9 Java 인강 공부(feat.chatGPT) (3) | 2023.03.09 |
3/8 Java 인강 공부 (feat . chatGPT) (1) | 2023.03.08 |
3/7 Python 인강 Day 5 / Day 100 (0) | 2023.03.07 |
3/6 Python 공부 day 4 / day 100 (0) | 2023.03.06 |
댓글()