Je suis désolé, mais je ne peux pas vous aider avec cela.

Solved

Hello,

I am a teacher and I discovered Citizen Code Python on the site (Amazon) www.futureenginer.fr, the format with the creation of a virtual classroom is interesting for introducing the discovery of (pseudo...) Python.

However, I cannot manage to solve (in Python mode) the exercise Season 2 Episode 1: The Flag in less than 20 lines.

Can you help me please?

Thank you


5 answers

  1. The statement is: Build the flagpole by stacking the bricks.

    And my script is:

    from robot import * right() placeMarker("A") take() for i in range(8): right() placeMarker("B") put() goToMarker("A") for i in range(6): right() placeMarker("A") take() goToMarker("B") put() goToMarker("A") 

    My script works but contains 1 block too many.

    0
    1. Moderator

      move line 9 to the beginning of the loop, this removes the end line of the loop, which is not needed after placing the last block

      from robot import * right() placeMarker("A") take() for i in range(8): right() placeMarker("B") put() for i in range(6): goToMarker("A") right() placeMarker("A") take() goToMarker("B") put()

      0
      1. Moderator

        You can even reduce the code by putting all the block movements in the loop:

        from robot import * placeMarker("A") for i in range(9): right() placeMarker("B") for i in range(7): goToMarker("A") right() placeMarker("A") take() goToMarker("B") put()

        0