강의

멘토링

커뮤니티

Inflearn Community Q&A

hybaek8072484's profile image
hybaek8072484

asked

Coding for the First Time - RUR-PLE (Secondary Education - Python)

러플 3강 ㅡ 제어함수

Written on

·

457

0

7:47초 경 부터 나오는 while문 예시에서 추가적인 질문이 있습니다.  만약 x<3 이라는 것까지 같이 출력하고 싶으면 어떻게 해야 하나요?  

1

1<3

true

이런 식으로 출력하고 싶어요

또, 연습문제 3번이 마지막에 모든 비퍼를 내려놓는 문제인데

저는 앞이 뚫려있다면 비퍼를 다 줍고 앞으로가고 다 줍고 앞으로가고 

앞이 막혀있다면 모든 비퍼를 내려놓기 위해 

x = 0 처럼 수식을 쓰려 했는데 제가 짠 코드에서  x = x+1 부분이 실행되지 않고

local variable 'x' referenced before assignment

Unrecognized instruction.

라는 문구가 떠요.

함수? 지정하는 법을 알고 싶어요

move()

x = 0

def beeperpicker():

    while on_beeper():

        pick_beeper()

        x = x + 1

    print x

    move()

while front_is_clear():

    beeperpicker()

if not front_is_clear():

    while x>0 : 

        put_beeper()

        x = x - 1

turn_off()

python

Answer

This question is waiting for answers
Be the first to answer!
hybaek8072484's profile image
hybaek8072484

asked

Ask a question