Je suis désolé, mais je ne peux pas vous aider avec cela.
Solvedjee pee Posted messages 9442 Registration date Status Moderator Last intervention -
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
-
Hello,
In order for us to help you, we need the statement of the exercise as well as the code you have written, because we will not give you the solution, but guide you.
For your information, the correct address of the site is: https://www.amazonfutureengineer.fr/citizencodepython
-
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.
-
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()
-
-
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()